Prestashop: 500 response when sending a WebService Get for a Product

Created on 14 Nov 2020  路  4Comments  路  Source: PrestaShop/PrestaShop

Describe the bug

A 500 error response occurs when invoking the WebService Get request for any product, for example api/products/724.

<br />
<b>Notice</b>: Undefined offset: 1 in <b> public_html/webservice/dispatcher.php</b> on line <b>39</b><br />

Fatal error: Uncaught Error: Function name must be a string in public_html/classes/WebserviceOutputBuilder.php:527
Stack trace:
#0 public_html/classes/WebserviceOutputBuilder.php(470): WebserviceOutputBuilderCore->renderField(Object(Product), Array, 'id_default_imag...', Array, 0)
#1 public_html/classes/WebserviceOutputBuilder.php(381): WebserviceOutputBuilderCore->renderEntity(Object(Product), 0)
#2 public_html/classes/webservice/WebserviceRequest.php(1855): WebserviceOutputBuilderCore->getContent(Array, NULL, 'full', 0, 2)
#3 public_html/classes/webservice/WebserviceRequest.php(628): WebserviceRequestCore->returnOutput()
#4 public_html/webservice/dispatcher.php(89): WebserviceRequestCore->fetch('KEYKEYKEYKEYKEYKEY...', 'GET', 'products/724', Array, false, NULL)
#5 {main}
  thrown in public_html/classes/WebserviceOutputBuilder.php on line 527

The issue most probably is either data/configuration specific to my setup, since the shop has upgraded multiple times since 1.4.x that I started using prestashop.

WebService is enabled with a token that has access to products. This was working on 1.6.x but stopped after upgrading to 1.7.x

The WebService is responsive to other endpoints, when triggering for example api/products/ without specifying an id, a list with all the products is returned on a 200 Ok response.

Any help or advice will be greatly appreciated.

Expected behavior

A 200 Ok respond containing the product information

Steps to Reproduce

Steps to reproduce the behavior:

  1. Enable WebServices
  2. Create a token with access to products
  3. Enable Shop Debug mode
  4. Send a WebService Get request for a specific product
  5. See error on the response

Additional information

  • PrestaShop version: 1.7.6.8
  • PHP version: 7.2.34
1.7.6.8 Bug Can't Reproduce WS Webservice

All 4 comments

Hello @thdouk

I didn't manage to reproduce your issue with PS1.7.6.8, see the attached screen record below:

https://drive.google.com/file/d/1hiUMKRuh2f3rTOEJOVOjjpK6Cm2zwDhF/view

Could you please provide more infos, like is there any errors launched while upgrading your store.

Thanks!

No errors occurred during the upgrade, I checked the autoupgrade/tmp/log.txt as well to verify.
It seems that this is data specific, which is bad news.
What would cause this error? How can I address an issue of such? Can I validate somehow that the data stored are correct or could you point me to where the data are being queried to investigate further?

How would you suggest troubleshooting this? I have good technical background but lacking php skill :(

Hello @thdouk ,

We use GitHub issues only to discuss about bugs and new features in the PrestaShop project. If you have questions about using PrestaShop or third-party modules, or if you need help with your shop, please consider one of our support plans.

Alternatively, you can also ask for help in the community forums or in the public Slack channel.

Thanks!

Thanks for having a look anyway :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vincent-dp picture vincent-dp  路  3Comments

itisco picture itisco  路  3Comments

matks picture matks  路  3Comments

rGaillard picture rGaillard  路  3Comments

centoasa picture centoasa  路  3Comments