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

Problems "must be of type string (or int), null given" and Memcached #36126

Open
2 tasks done
DimitriBouriez opened this issue May 10, 2024 · 3 comments
Open
2 tasks done
Labels
8.1.x Branch Bug Type: Bug NMI Status: issue needs more information Order Component: Which BO section is concerned Stocks Label: Which BO under menu is concerned Waiting for QA Status: action required, waiting for test feedback

Comments

@DimitriBouriez
Copy link

DimitriBouriez commented May 10, 2024

Prerequisites

Describe the bug and add attachments

I had a problem with retrieving the stock location for products that are no longer available when viewing an old order. Normally, this should return false when the stock location is not found. But when the Memcached cache is active, the null value is returned, causing a fatal error. This must be linked to the fact that Memcached doesn't distinguish between null and false.

To correct my specific problem, I added the following processing at the end of the setProductCurrentStock() method in /classes/order/Order.php:
if ($product['location'] === null) {
$product['location'] = false;
}

This ensures that false is returned and not null.

The following issues seem to be affected by a similar bug:
#22215
#35753
#35979

Expected behavior

No response

Steps to reproduce

  1. Enable Memcached cache
  2. Create an order
  3. Delete an ordered product from the catalog
  4. View order

PrestaShop version(s) where the bug happened

8.1.2

PHP version(s) where the bug happened

No response

If your bug is related to a module, specify its name and its version

No response

Your company or customer's name goes here (if applicable).

No response

@DimitriBouriez DimitriBouriez added Bug Type: Bug New New issue not yet processed by QA labels May 10, 2024
@florine2623
Copy link
Contributor

Hello @DimitriBouriez ,

Do you have the same issue with memcached disabled ?

Thanks!

@florine2623 florine2623 added Waiting for author Status: action required, waiting for author feedback NMI Status: issue needs more information Order Component: Which BO section is concerned Stocks Label: Which BO under menu is concerned 8.1.x Branch and removed New New issue not yet processed by QA labels May 14, 2024
@DimitriBouriez
Copy link
Author

Hello @florine2623 ,
Once the Memcached cache is deactivated, everything works as expected.
Regards,

@florine2623
Copy link
Contributor

@PrestaShop/qa-functional
Can someone try to reproduce this issue please ? I'm encountering this error while testing.

@florine2623 florine2623 added Waiting for QA Status: action required, waiting for test feedback and removed Waiting for author Status: action required, waiting for author feedback labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.1.x Branch Bug Type: Bug NMI Status: issue needs more information Order Component: Which BO section is concerned Stocks Label: Which BO under menu is concerned Waiting for QA Status: action required, waiting for test feedback
Projects
None yet
Development

No branches or pull requests

2 participants