Skip to content

Fix #9741 SOAP API problems after upgrading PHP. Suite 7.14 on PHP 8.2. #10289

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

Open
wants to merge 1 commit into
base: hotfix
Choose a base branch
from

Conversation

chris001
Copy link
Contributor

@chris001 chris001 commented Dec 27, 2023

Fixes #9741

Issue report on forum:
https://community.suitecrm.com/t/soap-api-problems-after-upgrading-7-14-php-8-2/90179

Forum user pepeflores says:
"I’m using implicit frontend to sync outlook and suitecrm.

After upgrading to suitecrm 7.14 and php 8.2 and facing that no access to suitecrm is possible, even validate user/password.

the logs that the server is generating are

[Sun Sep 03 17:50:25.626332 2023] [proxy_fcgi:error] [pid 119143] [client 192.168.72.1:52393] 
AH01071: Got error nusoap.php on line 7111; 
PHP message: PHP Warning: Trying to access array offset on value of type bool in /var/www/crm.xxxx.com/https/include/nusoap/nusoap.php on line 7111; 

[Sun Sep 03 17:50:26.792383 2023] [proxy_fcgi:error] [pid 119075] [client 192.168.72.1:52394] 
AH01071: Got error 
‘PHP message: PHP Warning: 
Array to string conversion in /var/www/crm.xxxx.com/https/include/nusoap/nusoap.php on line 8930; 
PHP message: PHP Fatal error: Uncaught TypeError: 
call_user_func_array(): Argument #1 ($callback) must be a valid callback, 
non-static method SugarWebServiceImplv4_1::login() cannot be called statically 
in /var/www/crm.xxxx.com/https/include/nusoap/nusoap.php:5437
Stack trace:
#0 /var/www/crm.xxxx.com/https/include/nusoap/nusoap.php(5054): nusoap_server->invoke_method()
#1 /var/www/crm.xxxx.com/https/service/core/NusoapSoap.php(94): nusoap_server->service()
#2 /var/www/crm.xxxx.com/https/service/core/webservice.php(70): NusoapSoap->serve()
#3 /var/www/crm.xxxx.com/https/service/v4_1/soap.php(56): require_once(’…‘)
#4 {main}\n thrown in /var/www/crm.xxxx.com/https/include/nusoap/nusoap.php on line 5437

Description

Relevant error log text:

PHP Fatal error: Uncaught TypeError: call_user_func_array(): 
Argument #1 ($callback) must be a valid callback, non-static method 
SugarWebServiceImplv4_1::login() cannot be called statically 
in /var/www/crm.xxxx.com/https/include/nusoap/nusoap.php:5437

Forum user abuzarfaris proposes changing code for "calling class method" (static class call) to same code as found in the immediately following code block for "calling instance method" (non-static i.e. instance method call) so that the Fatal crash would not occur when running Suite 7.14 on the required PHP 8.x. Until now, PHP 7.x did not consider these Uncaught TypeErrors to be Fatal and cause a crash of this API login code. Now in PHP this does cause a Fatal and a crash and block API login.

A better fix may be to make static class calls work properly, without running them as instance method calls.

This fixes several bug reports for failed SOAP API login on PHP 8.x !

Motivation and Context

Allow API login on PHP 8.x to work without crashing with a Fatal uncaught TypeError exception.

How To Test This

Try to login thru the SOAP API before (fail to login) and after this change (login works and thus API works).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • My code follows the code style of this project found here.
  • My change requires a change to the documentation.
  • I have read the How to Contribute guidelines.

@SuiteBot
Copy link

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/soap-api-problems-after-upgrading-7-14-php-8-2/90179/12

@chris001 chris001 changed the title Fix SOAP API problems after upgrading 7.14 and php 8.2 Fix SOAP API problems after upgrading. Suite 7.14 and php 8.2 Dec 27, 2023
@chris001 chris001 changed the title Fix SOAP API problems after upgrading. Suite 7.14 and php 8.2 Fix SOAP API problems after upgrading PHP. Suite 7.14 on PHP 8.2. Dec 27, 2023
@serhiisamko091184 serhiisamko091184 added Status: Requires Code Review Needs the core team to code review Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Area: API Issues & PRs related to all things regarding the API Branch:Hotfix PR 4-8 Complexity Score given to PRs once assessed labels Jan 4, 2024
@serhiisamko091184
Copy link
Contributor

Hi @chris001,

thanks a lot for your PR!

Regards,
Serhii

@chris001 chris001 changed the title Fix SOAP API problems after upgrading PHP. Suite 7.14 on PHP 8.2. Fix #9741 SOAP API problems after upgrading PHP. Suite 7.14 on PHP 8.2. Jan 4, 2024
@SuiteBot
Copy link

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/suitecrm-8-5-implicit-frontend-integration/91683/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: API Issues & PRs related to all things regarding the API Branch:Hotfix PR 4-8 Complexity Score given to PRs once assessed Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Status: Requires Code Review Needs the core team to code review
Projects
None yet
3 participants