Yes, php8.0.
From the compatibility matrix (Compatibility Matrix :: SuiteCRM Documentation), suitecrm 7.13 supports PHP 7.4 and 8.0.
Thanks,
Yes, php8.0.
From the compatibility matrix (Compatibility Matrix :: SuiteCRM Documentation), suitecrm 7.13 supports PHP 7.4 and 8.0.
Thanks,
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.
It seems the problem is with function call_user_func_array that had a major change in PHP 8.
Switching back to PHP 7.4 fixed the issue.
Hi @pgr
We are facing same issue we are on php 8.0, SuiteCRM 7.13 & Rest API v4_1 doesnt work.But we have few systems connected with our CRM.
Is there any hotfix for this issue?
Thanks in advance for your help.
Regards,
Sravani
Hi,
if you get the same error (Uncaught Error: Unknown named parameter $application_name
) and you canāt downgrade php:
/service/core/REST/SugarRestJSON.php
$data = $json->decode($json_data);
if(array_key_exists('application_name', $data)){
unset($data['application_name'];
}
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.
Hi @crmspace Thank you for responding , I tried your solution but i am unable to retrieve session id via Rest API v4_1
I had to manually enter the code here, and I missed a bracket:
if(array_key_exists('application_name', $data)){
unset($data['application_name']);
}
Hi @crmspace Missed your previous response , Yes I have added correct bracket but still there is no response from login method.
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
Hi @blqt , Thank you - I tried removing application_name param still it doesnt work.
Can you help me with working code if you have already.
Thank you in advance for your help.
Regards,
Sravani
Can you check your PHP error log?
Hi @blqt ,
I have checked suitecrm.log , apache & php error log - I cant find any . Hereās the code i m using to retrieve the session id
<?php
$url = "{site_url}/service/v4_1/rest.php";
$username = "XXXX";
$password = "XXXX";
function call($method, $parameters, $url)
{
ob_start();
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_URL, $url);
curl_setopt($curl_request, CURLOPT_POST, 1);
curl_setopt($curl_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($curl_request, CURLOPT_HEADER, 1);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_request, CURLOPT_FOLLOWLOCATION, 0);
$jsonEncodedData = json_encode($parameters);
$post = array(
"method" => $method,
"input_type" => "JSON",
"response_type" => "JSON",
"rest_data" => $jsonEncodedData
);
curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($curl_request);
curl_close($curl_request);
$result = explode("\r\n\r\n", $result, 2);
$response = json_decode($result[1]);
ob_end_flush();
return $response;
}
//login -----------------------------------------
$login_parameters = array(
"user_auth" => array(
"user_name" => $username,
"password" => md5($password) ,
"version" => "1"
) ,
"application_name" => "RestTest",
"name_value_list" => array() ,
);
$login_result = call("login", $login_parameters, $url);
echo "<pre>";
print_r($login_result);
//get session id
$session_id = $login_result->id;
echo $session_id;
Iām surprised you donāt see anything in the PHP error log if it fails.
Can you try again after changing
āapplication_nameā => āRestTestā,
to
āapplicationā => āRestTestā,
Thatās hard to help without seing the apache/php error log.
Also, are you sure the login/password are correct?
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.
Hereās what I found in my error logs:
[17-Aug-2023 13:06:28 America/New_York] PHP Fatal error: Uncaught Error: Unknown named parameter $application_name in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php:94
Stack trace:
#0 /home/myserver/crm.myserver.com/suitecrm/service/core/SugarRestService.php(136): SugarRestJSON->serve()
#1 /home/myserver/crm.myserver.com/suitecrm/service/core/webservice.php(70): SugarRestService->serve()
#2 /home/myserver/crm.myserver.com/suitecrm/service/v4_1/rest.php(56): require_once(ā/home/pablostevā¦ā)
#3 {main}
thrown in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php on line 94
[17-Aug-2023 13:06:28 America/New_York] PHP Warning: Class āGoogle_Serviceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:06:28 America/New_York] PHP Warning: Class āGoogle_Service_Resourceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:06:28 America/New_York] PHP Warning: Class āGoogle_Modelā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:06:28 America/New_York] PHP Warning: Class āGoogle_Collectionā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:06:28 America/New_York] PHP Fatal error: Uncaught Error: Unknown named parameter $application_name in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php:94
Stack trace:
#0 /home/myserver/crm.myserver.com/suitecrm/service/core/SugarRestService.php(136): SugarRestJSON->serve()
#1 /home/myserver/crm.myserver.com/suitecrm/service/core/webservice.php(70): SugarRestService->serve()
#2 /home/myserver/crm.myserver.com/suitecrm/service/v4_1/rest.php(56): require_once(ā/home/pablostevā¦ā)
#3 {main}
thrown in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php on line 94
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Serviceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Service_Resourceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Modelā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Collectionā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Fatal error: Uncaught Error: Unknown named parameter $application_name in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php:94
Stack trace:
#0 /home/myserver/crm.myserver.com/suitecrm/service/core/SugarRestService.php(136): SugarRestJSON->serve()
#1 /home/myserver/crm.myserver.com/suitecrm/service/core/webservice.php(70): SugarRestService->serve()
#2 /home/myserver/crm.myserver.com/suitecrm/service/v4_1/rest.php(56): require_once(ā/home/pablostevā¦ā)
#3 {main}
thrown in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php on line 94
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Serviceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Service_Resourceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Modelā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Collectionā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Fatal error: Uncaught Error: Unknown named parameter $application_name in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php:94
Stack trace:
#0 /home/myserver/crm.myserver.com/suitecrm/service/core/SugarRestService.php(136): SugarRestJSON->serve()
#1 /home/myserver/crm.myserver.com/suitecrm/service/core/webservice.php(70): SugarRestService->serve()
#2 /home/myserver/crm.myserver.com/suitecrm/service/v4_1/rest.php(56): require_once(ā/home/pablostevā¦ā)
#3 {main}
thrown in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php on line 94
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Serviceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Service_Resourceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Modelā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Collectionā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Fatal error: Uncaught Error: Unknown named parameter $application_name in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php:94
Stack trace:
#0 /home/myserver/crm.myserver.com/suitecrm/service/core/SugarRestService.php(136): SugarRestJSON->serve()
#1 /home/myserver/crm.myserver.com/suitecrm/service/core/webservice.php(70): SugarRestService->serve()
#2 /home/myserver/crm.myserver.com/suitecrm/service/v4_1/rest.php(56): require_once(ā/home/pablostevā¦ā)
#3 {main}
thrown in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php on line 94
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Serviceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Service_Resourceā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Modelā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Warning: Class āGoogle_Collectionā not found in /home/myserver/crm.myserver.com/suitecrm/vendor/google/apiclient-services/autoload.php on line 21
[17-Aug-2023 13:07:16 America/New_York] PHP Fatal error: Uncaught Error: Unknown named parameter $application_name in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php:94
Stack trace:
#0 /home/myserver/crm.myserver.com/suitecrm/service/core/SugarRestService.php(136): SugarRestJSON->serve()
#1 /home/myserver/crm.myserver.com/suitecrm/service/core/webservice.php(70): SugarRestService->serve()
#2 /home/myserver/crm.myserver.com/suitecrm/service/v4_1/rest.php(56): require_once(ā/home/pablostevā¦ā)
#3 {main}
thrown in /home/myserver/crm.myserver.com/suitecrm/service/core/REST/SugarRestJSON.php on line 94
[17-Aug-2023 13:24:46 America/New_York] PHP Fatal error: Uncaught Error: Cannot use object of type OAuthToken as array in /home/myserver/crm.myserver.com/suitecrm/modules/OAuthTokens/OAuthToken.php:307
Stack trace:
#0 /home/myserver/crm.myserver.com/suitecrm/include/SearchForm/SearchForm2.php(700): displayDateFromTs(Object(OAuthToken), āTOKEN_TSā, āā, āSearchForm_basiā¦ā)
#1 /home/myserver/crm.myserver.com/suitecrm/include/SearchForm/SearchForm2.php(139): SearchForm->_build_field_defs()
#2 /home/myserver/crm.myserver.com/suitecrm/include/SubPanel/SubPanelDefinitions.php(193): SearchForm->setup(Array, Array, āSubpanelSearchFā¦ā, ābasic_searchā)
#3 /home/myserver/crm.myserver.com/suitecrm/include/SubPanel/SubPanelDefinitions.php(111): aSubPanel->buildSearchQuery(āOAuthTokensā)
#4 /home/myserver/crm.myserver.com/suitecrm/include/SubPanel/SubPanelDefinitions.php(712): aSubPanel->__construct(ātokensā, Array, Object(OAuthKey), false, false, āā, Array)
#5 /home/myserver/crm in /home/myserver/crm.myserver.com/suitecrm/modules/OAuthTokens/OAuthToken.php on line 307
Thereās a related thread here
I suggest we all continue the conversation there, it has some new information and a workaround.