Facing issues after Upgrading SuiteCRM from 7.4 to 7.10.5 and PHP from 5.6 to 7.1

Hi,

I have recently upgraded my SuiteCRM 7.4.3 version to the latest available version SuiteCRM 7.10.5 and also I upgraded PHP version 5.6 to 7.1 through WHM. Upgrade went successful but I am facing following 2 issues.

  1. The lead save has a random behavior when I enter an email address. Sometimes I add the email address correctly but sometimes for some users it does not save the email address but saves other info. The email address field is empty after saving the lead. But this happens sometimes, not all the time.

  2. It is creating a FATAL log into the error_log file under CRM directory. I know I can disable the error logs and it will not print but my concern is why it’s printing that huge log. That log was printed hundreds of time. Here you can see that log below:

    [25-May-2018 20:18:51 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function SugarWebServiceImplv3_1::login(), 1 passed in /home/betacrm/service/core/REST/SugarRestJSON.php on line 91 and at least 2 expected in /home/betacrm/service/v3_1/SugarWebServiceImplv3_1.php:309
    Stack trace:
    #0 /home/betacrm/service/core/REST/SugarRestJSON.php(91): SugarWebServiceImplv3_1->login(Array)
    #1 /home/betacrm/service/core/SugarRestService.php(133): SugarRestJSON->serve()
    #2 /home/betacrm/service/core/webservice.php(66): SugarRestService->serve()
    #3 /home/betacrm/service/v3_1/rest.php(53): require_once(’/home/…’)
    #4 {main}
    thrown in /home/betacrm/service/v3_1/SugarWebServiceImplv3_1.php on line 309

Please help me ASAP to fix my issue as I have a doubt of missing many leads.

THANK YOU!

I have never seen that error. Since it is related to an API call, I would have to ask, do you have any integration, any add-on, that could be trying to call the API?

1 Like

Yes, the CRM was already working fine. There is a desktop app created a few years ago, that fetches leads from a website and then post to my SuiteCRM. That app uses SOAP API I think. Another app that is also desktop and that uses REST API. Both these apps fetch leads from a Website and then submit to CRM after some filtration. Besides these, I also have my own Website and customers directly submits their requests from a landing page. This integration uses REST API.

At the time I can see the leads from all sources but fewer leads than usual. Especially there was only one lead after system upgrade from the app that uses SOAP API, that’s why I went to the error_log file and found this.

Please help me to make the system work as it was working before.

THANKS

I hope this is a test system, and you’re just testing the upgrade… it is a really bad idea to just jump into new versions when you have custom code like this…

You really need to talk to the developer of those customizations, or get another developer to look at that. The old versions of the API weren’t changed, they are there for backwards compatibility, but some other detail must be giving you problems. But there isn’t much advice I can give without being there debugging your custom code…

1 Like

Thank you for your advice. That is the working instance, not only test system. Its the production system and I am the developer of this system. Leads are always coming to the system but after the upgrade, the ratio is down and this log is irritating me. And yes, there are customizations on the CRM but all of those are upgrade safe, mostly they have logic hooks, schedules etc. Nothing is customized in the core files/directories. I am worried about this.

The second issue I mentioned is also serious. That is related to saving email address. That has a random behavior. Most of the time when we edit any lead and save, it does not save the email address. The email address field goes empty. Sometimes it works fine but sometimes it shows empty email address field. For a quick solution to keep my system up and working, I modified the SAVE function of Lead under the Lead.php file in the main directory. The attached screenshot shows the code I have added to fix it for now. This is just for now, while I am testing this on the test system to find the reason and after that, I will remove this code. But as I told you it has random behavior, so I can’t easily check this. It fails to save email address randomly.

Does your file master/service/core/REST/SugarRestJSON.php match this one exactly?

https://github.com/salesagility/SuiteCRM/blob/master/service/core/REST/SugarRestJSON.php

I am trying to understand why your line 91 might be calling this “login” function with too few parameters.

About the problems saving emails, random behaviours are always something to be suspicious of… very weird. Let’s do some sanity checks on your database. Please go in phpMyAdmin and run the query on the top of this post:

https://pgorod.github.io/Database-tables-size/

This way we can check if you have any overgrown tables that might be stressing out your system.

1 Like

Thank you for taking it seriously. I have looked into the file ‘SugarRestJSON.php’ and its the same as you sent. Nothing is changed.

For database query, I have run the query you sent, there is was nothing so big. Basically, the database size was 5.6GB when I upgraded the system but after the upgrade, I cleared some tables like emails_text of 4.6GB. Finally, the database size was reduced to 400MB after clearing those tables. And now when I run that query on the job_queue table, I found 551764 records of almost 200mb. I cleared them as well (removed the jobs done so far).

For email saving, I found one more thing, when a lead is created, it doesn’t show the email address there but in activities subpanel, I can see an email is sent to that lead. There is an after save logic hook to Leads, that sends an instant email after lead creation. So it means the first time the email address comes to CRM, the bean contains email address in the field email1 (this is used for sending email). But when I visit the lead it does not show that email address. This is strange because when I try to debug it works fine. It has random behavior. Last night I have tested the leads in my production and 41 leads were missing email addresses but in activities section, the email was sent to them.

Can you check at this point

https://github.com/salesagility/SuiteCRM/blob/master/service/core/REST/SugarRestJSON.php#L91

why your $data array has only one element, instead of the expected 3? It’s coming from your API call, so you can probably change it to correct the problem (even though I don’t understand why the problem started appearing now, since this code didn’t change).


About the email saving, I wonder if you could be having a race condition. Two bits of code writing to the same bean (or relationship), when one moves faster than the other, one thing happens, but sometimes it happens in the reverse order…?

1 Like

That file is same as you sent a link to the file. See attached screenshot of the function.

For emails, I am not manually adding anything. Everything comes through API calls or when I click save button on Lead Editview. In after saving logic hooks, it checks if the $bean->email1 is not empty, it sends an email.

By the way, I have just compared the services directories of both instances (new upgraded instance and that old one). I didn’t find any change. Both directories and files are same with similar content. I compared those using Araxis Merge software.

At this point, I am not asking if the file is the same, we established that earlier.

I was asking you to debug and check the variable $data. It’s coming from you JSON in the Request, and it’s going into a callback function call with call_user_func_array.

It’s possible that the code didn’t change, but that PHP’s reaction to this mismatch is now more forceful, with a FATAL error, where maybe before it wouldn’t complain as much. But if you give it what it expects, it should work, so we need to dig into that.

1 Like

OK. thank you! I will check this, can you tell me which params this $data array should have?

Your PHP Fatal error message is telling you where to look:

https://github.com/salesagility/SuiteCRM/blob/master/service/v3_1/SugarWebServiceImplv3_1.php#L309

1 Like

Thank you for the help pgr!

The issue was related to PHP Backward incompatible changes. Here is the reference link: http://php.net/manual/en/migration71.incompatible.php

To solve this it was difficult for me to modify the app which is sending leads to CRM, so I modified the files in CRM to check if the required params are not receiving, then create them. First, it was the issue with login function and after fixing that it occurred for get_entry_list function. So I solved both as mentioned in screenshots and its working fine for me.

1 Like