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
Customer Account / Order History ContextErrorException when it crashed during order creation #27967
Comments
Hello @NicolasCador Thanks for your report. Thanks ! |
Hello @HanaRebaiQA customer ZJA means any customer There isn't any screenshot, it's internal, if you had a crash during order creation for any reasons, the data in the database (table ps_order_history) are not fully Ok, and when you go in Order History in your Account, there is a ContextErrorException. To simulate a crash during order creation, you can create an order and remove its SQL lines from table ps_order_history. |
Hello @NicolasCador , I can't reproduce you issue on PS 1.7.8.5. Please check my screen record : Screen.Recording.2022-03-22.at.10.42.38.movIs there another step I missed ? |
Hello @florine2623 , good idea the screen record, I should have done that. I understood screenshots, sorry. in fact, the problem isn't in the BO, it's in the FO when the Customer wants to see his/her order history, today, it gives a "ContextErrorException : Trying to access array offset on value of type null". in this configuration you did in the screen record, if you go in the FO, in your account, and click on history orders, you'll see the error. |
Hello @NicolasCador I checked your issue with PS1785 and PS1784 and i was unable to reproduce it with php7.2 and php7.3
1784 with php 7.4 :NOK ❌ 1784.with.php7.4._.NOK.mp41785 with php 7.4 :NOK ❌ PS1785.NOK.with.PHP7.4.mp41784 with php 7.2 : OK 1784.with.php.7.2._.OK.mp41785 with php 7.3 : OK 1785.with.php7.3._.OK.mp4So, it's a regression cause it's only appearing with php7.4 Good for the PR. Thank you! |
Hello @HanaRebaiQA , ok, thank you, great job of investigation ! I thought it was a problem from PHP 7.3 to 7.4, but I was not sure. So finally it appeared when I switched to PHP 7.4 after Prestashop 1.7.8 migration. |
Hello all, I created a new Pull Request in the right branch 1.7.8.x : #28117 |
Prerequisites
Describe the bug and add screenshots
When an order is missing in table ps_order_history due to a crash during order creation, and when customer wants to see his/her order history, today, it gives a "ContextErrorException : Trying to access array offset on value of type null", because $orderState becomes null and so $orderState['name'], $orderState['invoice'], $orderState['color'] can't exist. By using Null Coalescing Operator instead of Ternary Operator, we avoid the error.
Expected behavior
It should show the list of Orders
I proposed a new code here : #27179
Steps to reproduce
PrestaShop version(s) where the bug happened
1.7.8.4
PHP version(s) where the bug happened
7.4
If your bug is related to a module, specify its name and its version
No response
The text was updated successfully, but these errors were encountered: