I’m migrating a SuiteCRM instance to a new server. Everything is pretty much the same except for the PHP version which is php8 on the new server and PHP 7.4 on the older one.
The problem is every time I call a REST Api function, I have the following error in the apache logs:
[Wed Jan 11 07:30:39.220385 2023] [php:error] [pid 2471] [client ***************] PHP Fatal error: Uncaught Error: Unknown named parameter $application_name in /var/www/SuiteCRM/service/core/REST/SugarRestJSON.php:94\nStack trace:\n#0 /var/www/SuiteCRM/service/core/SugarRestService.php(136): SugarRestJSON->serve()\n#1 /var/www/SuiteCRM/service/core/webservice.php(70): SugarRestService->serve()\n#2 /var/www/SuiteCRM/service/v4/rest.php(56): require_once(’…’)\n#3 {main}\n thrown in /var/www/SuiteCRM/service/core/REST/SugarRestJSON.php on line 94
[Wed Jan 11 07:30:39.405727 2023] [php:error] [pid 2473] [client ***************]] PHP Fatal error: Uncaught Error: Unknown named parameter $favorite in /var/www/SuiteCRM/service/core/REST/SugarRestJSON.php:94\nStack trace:\n#0 /var/www/SuiteCRM/service/core/SugarRestService.php(136): SugarRestJSON->serve()\n#1 /var/www/SuiteCRM/service/core/webservice.php(70): SugarRestService->serve()\n#2 /var/www/SuiteCRM/service/v4/rest.php(56): require_once(’…’)\n#3 {main}\n thrown in /var/www/SuiteCRM/service/core/REST/SugarRestJSON.php on line 94
The SuiteCRM logs do not report anything in particular.
Putting aside the PHP version, the code and database is the same.
Any way, if you can try running it with PHP 7.4 and the error goes away, it could be an interesting diagnostic to see if this is a PHP version problem or not.
this is just a fast workaround, it solved a login issue I had in a sandbox system, but I didn’t test anything further than that. Maybe there is also an approved fix already on github.
I believe that in your REST call, the three parameter names should be
user_auth
application
and
name_value_list
these are named parameters of the REST login function and my guess is that application_name does not work with PHP 8 due to a change in call_user_func_array
Are you sure you’re dealing with the same error message like the OP? My code snippet should remove the application_name from the transformed json which is causing that error. If you get the same message, try removing "application_name" => "RestTest", from your $login_parameters.
Watching! I just spent half a day trying to connect Mautic to SuiteCRM via API and couldn’t figure out the problem. I tried another working install of SuiteCRM to connect to and voila, no problems. Only difference is the installation is running 7.4. So I switched my new install from 8.0 to 7.4 and connected no problems. Both of these are test instances, so if I can help in any way troubleshoot the php8 problem. I’m happy to.