How to fix SugarCRM | unexpected $end in include/utils/mvc_utils.php(48) : eval()'d code on line 1

Print PDF

What do you do when SugarCRM suddenly stops working?

Imagine the situation. The client has been successfully using SugarCRM for the last 18 months. Then one day, it goes off air, and they get this meaningful error message:

unexpected $end in include/utils/mvc_utils.php(48) : eval()'d code on line 1 

Ouch! That's not what the client wants to see when they are about to look at their sales forecast, or update some of their customer contact details.

The client's data is still safe and secure, however, they can no longer access their vital information - the SugarCRM user interface is broken. That's fairly damned mission critical, I would say.


Who changed something in the SugarCRM stack?

SugarCRM is built with PHP script. This particular flavour of SugarCRM, the Community Edition, is Open Source, which means that the script is freely availiable for developers like me to have a look at, and modify according to my clients' needs.

The SugarCRM is usually installed and hosted on a web server out there on the Internet, and it depends on a technology stack to work. It needs the Linux operating system on the server, Apache for the web services, MySQL to provide secure database storage, and of course the PHP scripts. Linux plus Apache plus MySQL plus PHP. Or LAMP for short.

Now I know for a fact that I did not change the SugarCRM PHP script, and I have not tinkered with the database. But when something stops working, it means something, somewhere has been changed.

It turns out that my web hosting company upgraded their servers to PHP 5.2.9, which they are entitled to do, however, I was not aware of this. It seams that a bug in the SugarCRM had been masked all this time. The bug only revealed itself when the server was upgraded.

To overcome this, there is no real choice, but to delve into the SugarCRM PHP code to find the problem and make the fix. I call this CRM Plumbing !


CRM Plumbing | SugarCRM Bug Fix

The offending script can be found here:

my_sugar_install_directory
include
utils
mvc_utils.php

The mvc_utils.php code looks like this:



Apparently, this code generates a function to track the SugarCRM package, to make sure that no one like me has tinkered about with copyright statements or removed the SugarCRM Logos. Not really essential, but nevertheless, its broken and needs fixing.

Towards the end of the file, you will see this bit which is the offending code:

cyk7ICB9IH0=IA==IA==IA==IA==IA==

This needs to be changed to:

cyk7ICB9IH0gICAgICAgICAgICAgICA=

Then browse back to your SugarCRM, and voila, you should see your login screen. Your CRM is back on air.

If you are a developer, I hope this saves you bouncing round the forums on a wild goose chase for a few hours. If you are just wondering why your SugarCRM suddenly stopped working, then Business2dot0 can help you with your CRM plumbing, and get you back up and running!


Some editors will not allow you to see such long lines of code. Only when I used the editor on the servers control panel (cPanel), could I scroll to the end of the line.
This fix should work for SugarCRM Community Editions 5.0.x, and 5.1.x

For version 5.2.x, follow the same procedure, but look for this offending code:
aSgkZnMpOyAgIH0gfSA=IA==IA==IA==
and replace it with:
aSgkZnMpOyAgIH0gfSAgICAgICAgICAg

From version 5.2.0c onwards, apparently the problem is fixed.