oroinc / orocommerce

Main OroCommerce package with core functionality.
http:///www.orocommerce.com/
Other
193 stars 84 forks source link

Bug in TaxValueManager #152

Open borisde opened 2 years ago

borisde commented 2 years ago

Summary
There is an error in logic for Oro\Bundle\TaxBundle\Manager\TaxValueManager::flushTaxValueIfAllowed that may lead to PHP Fatal Error

Steps to reproduce

  1. Disable taxation in admin panel: oro1

  2. Create an order (on front-store or from an admin panel): oro2

  3. Enable taxation in admin panel

  4. Click to Edit the created Order, update Line Item quantity or price, Click Save button: oro4

Actual Result PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted PHP Warning: Unknown: Cannot call session save handler in a recursive manner in Unknown on line 0

oro5

Additional information I believe the problem is in Oro\Bundle\TaxBundle\Manager\TaxManager and TaxValueManager.
Tax value was not set for the above Order, TaxManager is trying to save it in the saveTax method and flush changes to DB. Oro\Bundle\TaxBundle\Manager\TaxValueManager::flushTaxValueIfAllowed should check isFlushInProgress for TaxValueEntityManager, but for the above case changes are made with transaction and managed by Order entity manager, so $em->flush($entity); is called permanently and finally leads to PHP Fatal Error.

Details about your environment