salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.56k stars 2.11k forks source link

SuiteCRM 7.12.7 service/v3_1/SugarWebServiceImplv3_1.php PHP Fatal Error #9749

Open Laurentzed opened 2 years ago

Laurentzed commented 2 years ago

Issue

PHP Fatal error when importing emails from Implicit FrontEnd for SuiteCRM which prevents Outlook emails but also every other records to be pushed from Outlook to SuiteCRM server with release 7.12.7 whereas working with 7.12.5

Expected Behavior

Actual Behavior

Synchronization with Implicit FrontEnd from Outlook Emails/Contact/Accounts/Opportunities/Cases/Tasks to SuiteCRM server. Apache Log file shows: PHP Fatal error: Uncaught Error: Using $this when not in object context in /var/www/html/SuiteCRM/service/v3_1/SugarWebServiceImplv3_1.php:267

Possible Fix

Comment SugarWebServiceImplv3_1.php lines from 267 through 271 (lines reminded below from the orginal file). $valid = $this->validateFields($name_value_list, $module_name); if ($valid === false) { $GLOBALS['log']->info('End: SugarWebServiceImpl->set_entry'); return; }

Steps to Reproduce

  1. From Outlook archive an email to SuiteCRM server

Context

Your Environment

pgorod commented 2 years ago

It would be nice if you could get a stack trace of that FATAL error. This is being called from somewhere as a static method, it would help to know where from...

pgorod commented 2 years ago

Judging by the way the rest of the function uses to call the class methods, $this->validateFields probably needs to be changed to self::$helperObject->validateFields, but I didn't fully examine this, and I didn't test it, it's just a hunch.

Laurentzed commented 2 years ago

It would be nice if you could get a stack trace of that FATAL error. This is being called from somewhere as a static method, it would help to know where from...

Here is the Apache log trace I have: [Fri Sep 02 11:19:42.349961 2022] [php7:error] [pid 1431] [client 10.0.2.2:55681] PHP Fatal error: Uncaught Error: Using $this when not in object context in /var/www/html/SuiteCRM/service/v3_1/SugarWebServiceImplv3_1.php:267\nStack trace:\n#0 /var/www/html/SuiteCRM/include/nusoap/nusoap.php(5437): SugarWebServiceImplv3_1::set_entry()\n#1 /var/www/html/SuiteCRM/include/nusoap/nusoap.php(5054): nusoap_server->invoke_method()\n#2 /var/www/html/SuiteCRM/service/core/NusoapSoap.php(93): nusoap_server->service()\n#3 /var/www/html/SuiteCRM/service/core/webservice.php(70): NusoapSoap->serve()\n#4 /var/www/html/SuiteCRM/service/v4_1/soap.php(56): require_once('/var/www/html/S...')\n#5 {main}\n thrown in /var/www/html/SuiteCRM/service/v3_1/SugarWebServiceImplv3_1.php on line 267

Is it the stack trace you asked for?

pgorod commented 2 years ago

Yes. Thanks. If you get a chance please test the change I proposed above...

ebogaard commented 1 year ago

We fixed this issue (introduced in 7.12.5) by changing the following files: # service/v3_1/SugarWebServiceImplv3_1.php : around row 267

        //$valid = $this->validateFields($name_value_list, $module_name);
        $valid = self::$helperObject->validateFields($name_value_list, $module_name);

The copying the following functions from "service/v3_1/SugarWebServiceImplv3_1.php" to "service/v4/SugarWebServiceUtilv4.php" in the "SugarWebServiceUtilv4" class.

bunglex commented 1 year ago

Many thanks, this solved a problem for me using 7.13.1

I was getting fatal errors when trying to create a new contact via SOAP set_entry.

First time trying to create anything via soap, so expect i would have had the same issue on any module

chris001 commented 1 year ago

@ebogaard Can you make a PR with your code fix?