Syntax error in template on line 332 "{php}" unknown tag 'php'

Hi all, recently I upgraded My SuiteCRM from 7.12.x to 7.13 and finally to 7.14.1 i was fixing a lot bugs, but now i found some new bug to me :

Exception in Controller: Syntax error in template "file:/var/www/html/cache/themes/SuiteP/modules/Contacts/DetailView.tpl"  on line 332 "{php}" unknown tag 'php'

I have php7.4 and composer2 also i deleted cache file like /var/www/hml/cache/ and …/custom/cache but issue persists. any idea hoy can I fix this?

I found this post because I was doing web searches for the same problem.

I’m migrating a company’s SuiteCRM 7.12 (PHP 7.4) to a new VM with PHP 8.2 and then upgrading that SuiteCRM copy to 7.14.2 . There were several blank pages when testing. The log file had:

[602][1][FATAL] Exception in Controller: Syntax error in template "file:/var/www/html/cache/themes/SuiteP/modules/Contacts/SearchForm_advanced.tpl"  on line 565 "{php}$this->_tpl_vars['user_options'] = get_user_array(false);{/php}" unknown tag 'php'

It turns out that “php” can no longer be used as a tag in a Smarty template. The upgrade to SCRM 7.14 fixes most of these occurrences except one in our case. The Smarty template tags “{php} … {/php}” need to be changed to the standard PHP tags “<?php ... ?>”. Then, of course, run Quick Repair and Rebuild.

On that Debian VM I ran this command in the SuiteCRM directory to find the source of the error.

grep -ri --exclude-dir=upload --exclude-dir=vendor --exclude-dir=cache '{php}' *

Upgrading from 7.13 to 7.14.2. We have lots of blank pages, what is solution for it?

I used your command and I got few lines on the terminal. So I need to change like below?

{php}…{/php} ->to-> <?php....?>

In Leads module I have the below line.

{php}$this->_tpl_vars[“minutes_values”] = $this->_tpl_vars[“bean”]->minutes_values;{/php}

I will make it as below?

<?php $this->_tpl_vars["minutes_values"] = $this->_tpl_vars["bean"]->minutes_values; ?>

@rsp so, what happened when you tried that?

I still have blank pages and now I am trying to resolve.

Output of your command:


include/SugarFields/Fields/file/SugarFieldCstmfile.php:  return "{php} require_once('modules/FileField/license/OutfittersLicense.php');"
include/SugarFields/Fields/file/SugarFieldCstmfile.php: . "{php} } else { {/php}"
include/SugarFields/Fields/file/SugarFieldCstmfile.php: . "{php} } {/php}";

include/SugarFields/Fields/UTDynamicEnum/EditView.tpl:{*{php}

modules/Leads/metadata/convertdefs.php://{php}$this->_tpl_vars["minutes_values"] = $this->_tpl_vars["bean"]->minutes_values;{/php}
modules/Leads/metadata/convertdefs.php://{php}$this->_tpl_vars["minutes_values"] = $this->_tpl_vars["bean"]->minutes_values;{/php}

modules/Leads/tpls/ConvertLead.tpl:{{php}}$this->_tpl_vars['colData']['field']['displayParams']['idName'] = $this->_tpl_vars['module'] .$this->_tpl_vars['colData']['field']['name'];{{/php}}
modules/Leads/tpls/ConvertLead.tpl:{{php}}$this->_tpl_vars['colData']['field']['displayParams']['idName'] = $this->_tpl_vars['module'] . $this->_tpl_vars['colData']['field']['name'];{{/php}}

working/modules/Leads/metadata/convertdefs.php:{php}$this->_tpl_vars["minutes_values"] = $this->_tpl_vars["bean"]->minutes_values;{/php}
working/modules/Leads/metadata/convertdefs.php:{php}$this->_tpl_vars["minutes_values"] = $this->_tpl_vars["bean"]->minutes_values;{/php}

I need someone’s help to convert this code :melting_face:

The first one SugarFieldCstmfile.php is an Outfitters module license checker code, please contact the developer tech support or Outfitters tech support for update.

2 and 3 are commented out, should not be running/crashing.

4 looks strange, it has double curly braces {{php}} …?

5 looks like a backup file saved in working dir.

1 Like

Thank you. I will make those changes. :v:

@chris001 about the double braces, this is helpful:

1 Like