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

Customer Account / Order History ContextErrorException when it crashed during order creation #27967

Closed
2 tasks done
NicolasCador opened this issue Mar 18, 2022 · 8 comments
Closed
2 tasks done
Assignees
Labels
1.7.8.4 Affects versions Bug Type: Bug Fixed Resolution: issue closed because fixed FO Category: Front Office Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Order Component: Which BO section is concerned php Pull requests that update Php code PR available Solution: issue is being addressed Regression Type: regression Verified The issue has been reproduced

Comments

@NicolasCador
Copy link
Contributor

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

  1. Make an order in FO using customer ZJA
  2. Remove its SQL lines from table ps_order_history table
  3. Then browse customer account ZJA, click on order history.
  4. See error

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

@NicolasCador NicolasCador added Bug Type: Bug New New issue not yet processed by QA labels Mar 18, 2022
@HanaRebaiQA
Copy link

Hello @NicolasCador

Thanks for your report.
Could you please specify what do you mean by customer ZJA ? And could you please provide us a screen-record / screenshots to can repoduce it ?

Thanks !

@HanaRebaiQA HanaRebaiQA added FO Category: Front Office NMI Status: issue needs more information Order Component: Which BO section is concerned 1.7.8.4 Affects versions Waiting for author Status: action required, waiting for author feedback and removed New New issue not yet processed by QA labels Mar 18, 2022
@NicolasCador
Copy link
Contributor Author

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.

@prestashop-issue-bot prestashop-issue-bot bot removed the Waiting for author Status: action required, waiting for author feedback label Mar 18, 2022
@florine2623
Copy link
Contributor

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.mov

Is there another step I missed ?
Thanks!

@florine2623 florine2623 added the Waiting for author Status: action required, waiting for author feedback label Mar 22, 2022
@NicolasCador
Copy link
Contributor Author

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.

@prestashop-issue-bot prestashop-issue-bot bot removed the Waiting for author Status: action required, waiting for author feedback label Mar 22, 2022
@prestonBot prestonBot added the PR available Solution: issue is being addressed label Mar 23, 2022
@HanaRebaiQA
Copy link

HanaRebaiQA commented Mar 23, 2022

Hello @NicolasCador

I checked your issue with PS1785 and PS1784 and i was unable to reproduce it with php7.2 and php7.3
But, i'm able to reproduce it only with php7.4

  1. Make an order in FO with my customer
  2. Remove its SQL lines from table order_history table
  3. Go to FO again and check the Orders page
  4. See error

image

1784 with php 7.4 :NOK ❌

1784.with.php7.4._.NOK.mp4

1785 with php 7.4 :NOK ❌

PS1785.NOK.with.PHP7.4.mp4

1784 with php 7.2 : OK

1784.with.php.7.2._.OK.mp4

1785 with php 7.3 : OK

1785.with.php7.3._.OK.mp4

So, it's a regression cause it's only appearing with php7.4

Good for the PR.

Thank you!

@HanaRebaiQA HanaRebaiQA added Needs Specs Status: issue needs to be specified Verified The issue has been reproduced 1.7.8.x Branch php Pull requests that update Php code Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Regression Type: regression 1.7.8.4 Affects versions and removed NMI Status: issue needs more information 1.7.8.4 Affects versions 1.7.8.x Branch labels Mar 23, 2022
@HanaRebaiQA HanaRebaiQA added this to Regression issues 1.7.8.x in Backlog Patch via automation Mar 23, 2022
@NicolasCador
Copy link
Contributor Author

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.

@MatShir MatShir removed this from Regression issues 1.7.8.x in Backlog Patch Mar 28, 2022
@NicolasCador
Copy link
Contributor Author

Hello all, I created a new Pull Request in the right branch 1.7.8.x : #28117

@HanaRebaiQA HanaRebaiQA added Fixed Resolution: issue closed because fixed and removed Verified The issue has been reproduced labels Apr 7, 2022
@prestashop-issue-bot prestashop-issue-bot bot removed the Needs Specs Status: issue needs to be specified label Apr 7, 2022
@Progi1984 Progi1984 added this to the 1.7.8.6 milestone Apr 11, 2022
@matks matks modified the milestones: 1.7.8.6, 1.7.8.7 May 16, 2022
@kpodemski
Copy link
Contributor

@matks I think it was fixed in 1.7.8.6?
#28117

@HanaRebaiQA HanaRebaiQA added the Verified The issue has been reproduced label Sep 20, 2022
@matks matks removed this from the 1.7.8.8 milestone Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.8.4 Affects versions Bug Type: Bug Fixed Resolution: issue closed because fixed FO Category: Front Office Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Order Component: Which BO section is concerned php Pull requests that update Php code PR available Solution: issue is being addressed Regression Type: regression Verified The issue has been reproduced
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants