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:

2 Likes

This is still an issue on 7.14.6 for any modules created in Module Builder,
Since removing “created by” from searchdefs, the list view in my modules started working again

1 Like

Looks like team has merged the code three weeks back.

I did import the module project from another CRM. That CRM is flattened now and I can’t remember what version of Suite it was running so it may be that the version of Suite that made the initial project was older. I’ll keep a look out to see if this happens again and I’ll try to keep notes of how it end up back here :+1:

Looks like this is still an issue. Just installed 7.14.6 and the leads module has this issue:

Wed Jun 18 14:08:39 2025 [2483703][1][FATAL] Exception in Controller: Syntax error in template "file:/home/xxxxxxxxxx/public_html/cache/themes/SuiteP/modules/Leads/SearchForm_basic.tpl" on line 298 "{php}$this->_tpl_vars['user_options'] = get_user_array(false);{/php}" unknown tag 'php'

I added the changes from the commit and it fixed the issue. So I don’t think this commit is included in 7.14.6.

Looks like those code changes are in the GH code:

  1. SuiteCRM/include/SearchForm/SearchForm2.php at hotfix · salesagility/SuiteCRM · GitHub

  2. SuiteCRM/include/SugarFields/Fields/Assigned_user_name/SearchView.tpl at a82c9ff3b7f7838f4b9bbfbf556e57f7c4e874c4 · chris001/SuiteCRM · GitHub

What could be the issue then? What code did you change?

The updates are in github but not in the upgrade package. My newly updated 7.14.6 did not include these fixes.

That’s strange.

We need to ask @suitecrm_team. Team, could you please check these changes?

They are merged into hotfix, which mean they will be in the upcoming maintenance release. If you want to see what is in the current release refer to the master branch on github.

1 Like

Thanks a lot for your reply :smile: we understood that it will be in the next release v7.15 ESR.

The next releases will be 7.14.7/ 8.8.1, It will be included in these and therefore also the future 7.15 release also

2 Likes