Jump to content

[SOLVED] Function name must be a string


carbonhoarder

Recommended Posts

Hello,

I recently had to install prestashop on a one.com server; I'm using my own personal app to upload a catalogue on prestashop via the web service.

Everything works locally, but on the server I get this error when I try to upload the categories:

Fatal error: Uncaught Error: Function name must be a string in /customers/e/5/7/example.it/httpd.www/classes/webservice/WebserviceOutputBuilder.php:542\n
Stack trace:\n
#0 /customers/e/5/7/example.it/httpd.www/classes/webservice/WebserviceOutputBuilder.php(481): WebserviceOutputBuilderCore->renderField(Object(Category), Array, 'nb_products_rec...', Array, 0)\n
#1 /customers/e/5/7/example.it/httpd.www/classes/webservice/WebserviceOutputBuilder.php(385): WebserviceOutputBuilderCore->renderEntity(Object(Category), 0)\n
#2 /customers/e/5/7/example.it/httpd.www/classes/webservice/WebserviceRequest.php(1694): WebserviceOutputBuilderCore->getContent(Array, NULL, 'full', 0, 2)\n
#3 /customers/e/5/7/example.it/httpd.www/classes/webservice/WebserviceRequest.php(560): WebserviceRequestCore->returnOutput()\n
#4 /customers/e/5/7/example.it/httpd.www/webservice/dispatcher.php(87): WebserviceRequestCore->fetch('UPVGHUIN5WVTY4K...', 'POST', 'categories', Array, false, '<?xml version="...')\n
#5 {main}\n
thrown in /customers/e/5/7/example.it/httpd.www/classes/webservice/WebserviceOutputBuilder.php on line 542\n

Interestingly enough, the category does get uploaded, and the response header is 200. But the body of the response is just errors.

Does anybody know what the problem could be?

Edited by carbonhoarder (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

To support php 7

 

You have to override WebserviceRequest.php class and to modify this line 

 

$object->$fieldProperties['setter']((string)$attributes->$fieldName);

 

into

 

$object->{$fieldProperties['setter']}((string)$attributes->$fieldName);

  • Like 2
Link to comment
Share on other sites

  • 2 years later...
On 7/4/2017 at 7:50 PM, mlecoq said:

To support php 7

 

You have to override WebserviceRequest.php class and to modify this line 

 

$object->$fieldProperties['setter']((string)$attributes->$fieldName);

 

into

 

$object->{$fieldProperties['setter']}((string)$attributes->$fieldName);

In order to do this, I have to edit the WebserviceRequest.php in classes/webservice/WebserviceRequest.php ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...