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
Update function getCustomerOrders to avoid error #28117
Conversation
Hello @NicolasCador! This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community! |
Hi, thanks for this contribution! I found some issues with the Pull Request description:
Would you mind having a look at it? This will help us understand how interesting your contribution is, thank you very much! About linked issuesPlease consider opening an issue before submitting a Pull Request:
(Note: this is an automated message, but answering it will reach a real human) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @NicolasCador
I checked this PR. The issue is fixed.
Here my tested cases :
- Check the related issue : OK
- Check with create order from FO : OK
- Check with create order from BO : OK
- Check with create order from FO and update status from BO : OK
- Check with different php versions (php7.4 and php7.2) : OK
- Check with different languages (RTL and no RTL) : OK
- Check with multistore : OK
With php 7.4
PR28117.-.php7.4.mp4
With php 7.2
PR28117.-.php7.2.mp4
So, it's QA ✔️
Thanks!
QA approved, well done! Message to the maintainers: do not forget to milestone it before the merge. |
Thank you @NicolasCador @HanaRebaiQA |
Description
Today, it gives a "ContextErrorException : Trying to access array offset on value of type null", if there was a crash during order creation, 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.
How to test
Make an order in FO using customer ZJA
Remove its SQL lines from table ps_order_history table
Then browse customer account ZJA, click on order history.
See error
This change is