Magento 2.3.4 - infinite loop on checkout buttons
-
16-04-2021 - |
Domanda
Fresh 2.3.3 install with 2.3.4 composer upgrade.
If I try clicking Paypal or Stripe checkout (default magento 2 checkout) I get this error.
INTERNAL ERROR. DETAILS ARE AVAILABLE IN MAGENTO LOG FILE. REPORT ID: WEBAPI-5E3EBD55C7D77
LOG FILE SHOWS:
[2020-02-08 13:11:36] main.CRITICAL: Report ID: webapi-5e3eb38834d5a; Message: Infinite loop detected, review the trace for the looping path {"exception":"[object] (Exception(code: 0): Report ID: webapi-5e3eb38834d5a; Message: Infinite loop detected, review the trace for the looping path at /vendor/magento/framework/Webapi/ErrorProcessor.php:208, LogicException(code: 0): Infinite loop detected, review the trace for the looping path at /vendor/magento/module-checkout/Model/Session.php:241)"} []
Anyone able to shed some light on this? stupidly I made it live - so I have a live broken website.
Thanks!
Nessuna soluzione corretta
Altri suggerimenti
Don't try this on production
just a quicker workaround to get your checkout fixed.
edit this file vendor/magento/module-checkout/Model/Session.php (Override this file using preferences or use plugins if you know how-to)
app/code/Magento/Checkout/Model/Session.php
and go to method public function getQuote()
comment / remove these lines
if ($this->isLoading) {
throw new \LogicException("Infinite loop detected, review the trace for the looping path");
}
....
$this->isLoading = true;
.....
$this->isLoading = false;
this isLoading flag variable has been added for this purpose as documented in the code
A flag to track when the quote is being loaded and attached to the session object. Used in trigger_recollect infinite loop detection.
check this file on official magento2.3.4 repo for more information
https://github.com/magento/magento2/blob/2.3.4/app/code/Magento/Checkout/Model/Session.php
This is a stripe issue. Upgrade your stripe extension to the latest version (1.6.x) and it will be solved. Stripe module: https://stripe.com/docs/plugins/magento/install
Related Magento 2 core issue: https://github.com/magento/magento2/issues/26786
For temporary solution (works for me)(I face issue in Magento2.3.5 with one of third party payment module)
First you need to update third party module to latest one.
Or for temporary fix. (Not recommended)
You can replace/override Session.php file from Magento 2.3.3 to your current version
vendor/magento/module-checkout/Model/Session.php
change in file vendor/magento/module-checkout/Model/Session.php
This error comes in 2.3.4 or later versions because of
if($quote->getTotalsCollectedFlag() === false) { $quote->collectTotals(); }
Here, $quote->collectTotals(); generates error because of recursive call
so, by commenting $quote->collectTotals(); or whole if condition it will not go in infinite and code will work properly.
Actually there is no need of $quote->collectTotals(); in this file.
Delete your cookies and try again.