Syntax error in template on line 248 “{php}” unknown tag ‘php’

I recently updated to 7.14.5 and several of my users could not access the calls module.

I had these errors in my logs

Tue Sep 10 12:23:04 2024 [3004][6eded318-96fd-3d98-5c07-56b24937bd9f][FATAL] Exception handling in C:\website\Apps\Sugarcrm\htdocs\include\MVC\Controller\SugarController.php:397

Tue Sep 10 12:23:04 2024 [3004][6eded318-96fd-3d98-5c07-56b24937bd9f][FATAL] Exception in Controller: Syntax error in template “file:C:\website\Apps\Sugarcrm\htdocs\cache\themes\SuiteP\modules\Calls\SearchForm_advanced.tpl” on line 248 “{php}$this->_tpl_vars[‘user_options’] = get_user_array(false);{/php}” unknown tag ‘php’

I traced the problem to
\htdocs\include\SugarFields\Assigned_user_name\SearchView.tpl

It has this line
{php}$this->_tpl_vars[‘user_options’] = get_user_array(false);{/php}

I updated it to this line

<?php $this->_tpl_vars['user_options'] = get_user_array(false); ?>

After that a quick rebuild restored the users access.

I was affected by the smarty upgrade and the php problems.

I’m hoping someone can take this and get it applied to the main branch because the problematic {php} code is still in the tpl file from the 7.14.5 release zip as well as in the github.

You can see the problem line in the github here.

Thanks

Delete this folder and SuiteCRM will create this themes folder.

cache\themes\

https://community.suitecrm.com/search?q=%20unknown%20tag%20%27php%27

Yes, I have seen topics related to it in this forum.

Thanks for the troubleshooting step. I tried that but since it didn’t help I didn’t include it in my original post.
Only modify the file I listed above solved the problem for me.
Since this is a know issue about the smarty and {php} tag I’m hoping this last file in the official release will get updated so it isn’t a problem for anyone else.

Is your PHP version inside the matrix?

I guess you have added created by or modified by in your search fields.
There is a bug in SuiteCRM due to the use of this php tag when the field type is “assigned_user_name”

You can fix that in custom/modules/Calls/metadata/searchdefs.php
Change the way the created_by field is defined with the following.

      'created_by' => 
      array (
        'type' => 'enum',
        'label' => 'LBL_CREATED',
        'width' => '10%',
        'default' => true,
        'name' => 'created_by',
        'function' => 
        array (
          'name' => 'get_user_array',
          'params' => 
          array (
            0 => false,
          ),
        ),
      ),

You would have to adapt that if you added the modified_by field.

Yes I’ve made sure to run a compatible version

I’m running apache 2.4.62 with PHP 8.2.22

The proper fix is here (no php code running anymore in Smarty 3.1+ template). It’s approved and about to be added, probably will be in the next bugfix release:

1 Like