PHP Fatal error:  Cannot redeclare class TrimText in /custom/modules/Accounts/trim_text.php on line 15

When trying to convert a lead i click on the save contact button and i get a white screen and the apache log shows the below

PHP Fatal error:  Cannot redeclare class TrimText in /var/www/virtual/crm.hardent.com/custom/modules/Accounts/trim_text.php on line 15

I am using Version 6.5.20 (Build 1001) on CentOS release 5.4

Any ideas , i am so very new to SugarCRM

Thanks!

  • Hi Rob Morin 

    The script /var/www/virtual/crm.hardent.com/custom/modules/Accounts/trim_text.php is being included twice on saving the Contact/Account.

    Can you provide us the content of such script and also can you scan your SugarCRM instance looking for any reference to such script?

    Best regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • In versions 7.9 and beyond, I faced a similar error.

    After issuing

    $grep -rnw . -e 'class class_name'

    I have found something like

    ./modules/class_name/class_name.php:16:class class_name extends class_name_sugar {
    ./custom/modulebuilder/builds/class_name/SugarModules/modules/class_name/class_name.php:16:class class_name extends class_name_sugar {

    So we had 2 classes under the sugarCRM root

    for custom packages, this issue was linked to the composer.json .

    Solving

    It was necessary updating it as following:

    In file "composer.json" (root directory) locate the "exclude-from-classmap" array and add an entry of:
    "/custom/modulebuilder/**"

    In SugarCRM root dir, run "composer update -o --no-dev" to deploy the new dependencies.

    Clear the cache folder

    And that was it! 

    I would like to thanks the SugarCRM Support Team who came out with the solution.

  • Die Lösung ist OK, nur funktioniert sie nicht, wenn der Server nicht erreichbar ist. Composer meldet:


      [Composer\Downloader\TransportException] The "https://satis.sugardev.team/packages.json" file could not be downloaded: failed to open stream: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat.