Prestashop: Infinite loop and order blocked with two specific cart rules

Created on 17 Sep 2019  Â·  14Comments  Â·  Source: PrestaShop/PrestaShop

Describe the bug
Infinite loop and order blocked with two specific cart rules.

To Reproduce
Steps to reproduce the behavior:
With a fresh Prestashop 1.7.6.1 installation in debug mode. Follow this exactly in this order :

  1. Go to BO/cart rules
  2. Add a first cart rule without voucher code with 10€ HT gift
  3. Add a product condition on "Home" Category and save
  4. Add another cart rule without voucher code with free delivery
  5. Go to front and add a product to the cart : You'll have 500 error on the ajax call
  6. Reload page : you'll get the infinite loop with this error "Maximum function nesting level of '256' reached, aborting!"
  7. Go to BO / Carts : I'll get the infinite loop too

If xdebug is enabled, You'll get the error "Maximum function nesting level of '256' reached, aborting!" If not, php will crash and you'll only have a 500 error.

This bug is not present in 1.6, It's a regression.

It seems that cart rules are recursively evaluated and product list is reconstructed each call of cart computation.

As already disscussed with @matks, this PR should fix the bug https://github.com/PrestaShop/PrestaShop/pull/12878

Screenshots
cartrule1
cartrule2

Additional information
PrestaShop version: 1.7.6.1
PHP version: 7.0

1.7.6.0 1.7.6.1 Bug Cart rules FO Fixed Major Regression Shopping carts

Most helpful comment

All 14 comments

Hi @jf-viguier,

I manage to reproduce the issue with PS1.7.6.1 & develop branch & PS1.7.6.0.
image
In the BO => Orders => Shopping cart page => Error 500
https://drive.google.com/file/d/1NF_01f5wjBDMQ4ko4XHn1VWuETOHuovH/view

With PS1.7.5.2 => OK

image
https://drive.google.com/file/d/1UsFAYsqj_KjZz-TFA7z6_5xCaTy-jkRw/view
I’ll add this to the debug roadmap.
Thanks!

Thanks @khouloudbelguith
I can provide by email a real world dump with 300 cart rules for your future tests.

you are speaking about PR #12878, is this issue related to #11172

Unfortunately, after reviewing the PR, we have considered it does not fix the issue, so we put it back on the To do column and are going to work on it asap.

Unfortunately, after reviewing the PR, we have considered it does not fix the issue, so we put it back on the To do column and are going to work on it asap.

ok @colinegin and what's the plan to fix it ?

Unfortunately, after reviewing the PR, we have considered it does not fix the issue, so we put it back on the To do column and are going to work on it asap.

ok @colinegin and what's the plan to fix it ?

We go deeper in the code 😉
@PierreRambaud just assigned himself

Thanks @PierreRambaud : you've got all my support.

Hum, I tried many times with 1.7.5 and still have the problem. Seems not to be a regression.
image

We maybe found a fix with #15691 :crossed_fingers:

Hi all, have you validated the fix #15691 for this bug ?

@jf-viguier Still waiting for review and QA :/

ok thanks

Was this page helpful?
0 / 5 - 0 ratings