salesagility:hotfix
← chris001:patch-35
opened 05:19PM - 27 Dec 23 UTC
Issue report:
https://community.suitecrm.com/t/soap-api-problems-after-upgradin…g-7-14-php-8-2/90179
<!--- Please be aware that as of the 31st January 2022 we no longer support 7.10.x.
New PRs to hotfix-7.10.x will be invalid. If your fix is still applicable to 7.12.x,
please create the pull request to the hotfix branch accordingly. -->
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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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; 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\nStack trace:\n#0 /var/www/crm.xxxx.com/https/include/nusoap/nusoap.php(5054): nusoap_server->invoke_method()\n#1 /var/www/crm.xxxx.com/https/service/core/NusoapSoap.php(94): nusoap_server->service()\n#2 /var/www/crm.xxxx.com/https/service/core/webservice.php(70): NusoapSoap->serve()\n#3 /var/www/crm.xxxx.com/https/service/v4_1/soap.php(56): require_once(’…‘)\n#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](https://community.suitecrm.com/t/soap-api-problems-after-upgrading-7-14-php-8-2/90179/5) 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 TypeError`s 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
- [x] 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
- [x] My code follows the code style of this project found [here](https://docs.suitecrm.com/community/contributing-code/coding-standards/).
- [x] My change requires a change to the documentation.
- [x] I have read the [**How to Contribute**](https://docs.suitecrm.com/community/contributing-code/) guidelines.