Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.9.2: Infinite loop in Plugin/Tax/Config.php caused by getActive() #79

Closed
reense opened this issue Oct 22, 2021 · 4 comments
Closed

1.9.2: Infinite loop in Plugin/Tax/Config.php caused by getActive() #79

reense opened this issue Oct 22, 2021 · 4 comments
Labels
Fixed in next release This issue is reproduced and the fix will be there in the next release. Reflecting Plugin This is an issue reflecting the plugin

Comments

@reense
Copy link
Contributor

reense commented Oct 22, 2021

Hello,

We've upgraded the module from 1.7.0 to 1.9.2. However, when loading the checkout, PHP gets trapped in an infinite loop.

The problem is caused by Plugin/Tax/Config.php, specifically line 78. Getting the active cart causes an infinite loop. Here is the stack (from the initial Config.php call to the next one):

Config.php:77, Paazl\CheckoutWidget\Plugin\Tax\Config->afterShippingPriceIncludesTax()
Interceptor.php:146, Magento\Tax\Model\Config\Interceptor->Magento\Framework\Interception\{closure:/Users/reense/Projects/project/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Interceptor.php:153, Magento\Tax\Model\Config\Interceptor->___callPlugins()
Interceptor.php:122, Magento\Tax\Model\Config\Interceptor->shippingPriceIncludesTax()
CommonTaxCollector.php:462, Magento\Tax\Model\Sales\Total\Quote\Shipping\Interceptor->getShippingDataObject()
Interceptor.php:86, Magento\Tax\Model\Sales\Total\Quote\Shipping\Interceptor->getShippingDataObject()
Shipping.php:35, Magento\Tax\Model\Sales\Total\Quote\Shipping\Interceptor->collect()
Interceptor.php:23, Magento\Tax\Model\Sales\Total\Quote\Shipping\Interceptor->collect()
TotalsCollector.php:274, Magento\Quote\Model\Quote\TotalsCollector->collectAddressTotals()
TotalsCollector.php:148, Magento\Quote\Model\Quote\TotalsCollector->collect()
Quote.php:2015, Magento\Quote\Model\Quote\Interceptor->collectTotals()
Interceptor.php:743, Magento\Quote\Model\Quote\Interceptor->collectTotals()
Quote.php:2465, Magento\Quote\Model\Quote\Interceptor->_afterLoad()
Quote.php:915, Magento\Quote\Model\Quote\Interceptor->loadByIdWithoutStore()
Interceptor.php:338, Magento\Quote\Model\Quote\Interceptor->loadByIdWithoutStore()
QuoteRepository.php:236, Magento\Quote\Model\QuoteRepository\Interceptor->loadQuote()
QuoteRepository.php:136, Magento\Quote\Model\QuoteRepository\Interceptor->get()
Interceptor.php:58, Magento\Quote\Model\QuoteRepository\Interceptor->___callParent()
Interceptor.php:138, Magento\Quote\Model\QuoteRepository\Interceptor->Magento\Framework\Interception\{closure:/Users/reense/Projects/project/vendor/magento/framework/Interception/Interceptor.php:104-151}()
Interceptor.php:153, Magento\Quote\Model\QuoteRepository\Interceptor->___callPlugins()
Interceptor.php:23, Magento\Quote\Model\QuoteRepository\Interceptor->get()
QuoteRepository.php:168, Magento\Quote\Model\QuoteRepository\Interceptor->getActive()
Interceptor.php:41, Magento\Quote\Model\QuoteRepository\Interceptor->getActive()
Config.php:79, Paazl\CheckoutWidget\Plugin\Tax\Config->afterShippingPriceIncludesTax()

I've solved this problem for now by disabling this plugin. However, that is purely a temporary fix for the 26th of October.

I've tested this on Magento 2.4.2, 2.4.3 and 2.4.3-p1.

@peterjaap
Copy link

peterjaap commented Nov 12, 2021

Ran into this too!

For some reason, disabling the plugin didn't work, so I resorted to returning early;

Return early in plugin to avoid infinite loading in checkout

@package paazl/magento2-checkout-widget
@level 0
@link https://github.com/Paazl/magento2-checkout-widget/issues/79

diff --git Plugin/Tax/Config.php Plugin/Tax/Config.php
index 2a8eec0..4ee46a4 100644
--- Plugin/Tax/Config.php
+++ Plugin/Tax/Config.php
@@ -72,6 +72,7 @@ class Config
         bool $result,
         $store = null
     ) {
+       return $result;
         try {
             $cartId = $this->session->getQuoteId();
             //we can't use Magento\Checkout\Model\Session::getQuote() because of infinity loop on place order

@reense thanks for confirming I wasn't going out my mind 😂

@reense
Copy link
Contributor Author

reense commented Nov 12, 2021

@peterjaap
The odd thing about this bug that some customers do have the bug, and some other customers don't. I assume some other logic is going on, but I couldn't make that up from the infinite-loop stack trace.

The solution you're providing is the 'solution' we've implemented as well, I'm sorry I should've cleared that up in my comment 🙂

@Frank-Magmodules Frank-Magmodules added Reflecting Plugin This is an issue reflecting the plugin Fixed in next release This issue is reproduced and the fix will be there in the next release. labels Nov 18, 2021
@Frank-Magmodules
Copy link
Collaborator

HI @peterjaap and @reense ,

We are happy to share that we've just released the new 1.9.3 version with a fix for this issue.
Thank you for the detailed issue reports.

We are closing this issue now but please feel free to reopen the issue if this still occurs.

@reense
Copy link
Contributor Author

reense commented Nov 30, 2021

@Frank-Magmodules thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in next release This issue is reproduced and the fix will be there in the next release. Reflecting Plugin This is an issue reflecting the plugin
Projects
None yet
Development

No branches or pull requests

3 participants