Upgrade from 7.13 to 7.14 Cause editview errors regarding php tags

Version 7.14.2
Ubuntu 22 with 8.1.18 PHP as a virtualmin virtual server.

detail views seem to work fine, albeit I receive a blank page when I try to edit Accounts, and others.

The errors are:
Thu Jan 11 17:01:40 2024 [139905][1][FATAL] Exception handling in /home/crm712/public_html/include/MVC/Controller/SugarController.php:397

Thu Jan 11 17:01:40 2024 [139905][1][FATAL] Exception in Controller: Syntax error in template ā€œfile:/home/crm712/public_html/cache/themes/SuiteP/modules/Tasks/EditView.tplā€ on line 264 ā€œ{php}$this->_tpl_vars[ā€˜is_adminā€™] = $GLOBALS[ā€˜current_userā€™]->is_admin;{/php}ā€ unknown tag ā€˜phpā€™

I can see php tags in the code as the error suggests, albeit I donā€™t know how to remove/edit/fix the problem. Iā€™ve tried the usual suspects " quick repair" and deleting the cache files.

Also, I upgraded from 7.12 and then to 7.13 and finally to 7.14. We were about to use the system, but havenā€™t yet, so i donā€™t know for sure, however, I donā€™t think 7.13 was tested so the problem may have been there with 7.13. Any help is greatly appreciated and thanks for taking a look at my help post.

Itā€™s your version of smarty. The newer version removed support for the {php} tag from the templates. You could downgrade smarty to a lower version. Or search this community for other posts on this for a workaround. This came up already.

1 Like

Try this workaround!

Let us know if this solved your issue!

1 Like

Thank you CHRIS!!!

That worked, that worked that worked, It workedā€¦

One line of code, just one line stopped the whole thing. I ran the scan to find the php tags and found something close to this (I already removed the php part and made a small adjustment or two, albeit this is as close as I can remember and I wanted to put something here for others)ā€¦

{$this->_tpl_vars[ā€˜is_adminā€™] = $GLOBALS[ā€˜current_userā€™]->is_admin;|
|ā€”|ā€”|
||if $is_admin ==ā€˜1ā€™}|

I told Chatgpt to rewrite it for smarty 3.1 and it gave me thisā€¦

{assign var=ā€˜is_adminā€™ value=$GLOBALS.current_user.is_admin}
{if $is_admin == ā€˜1ā€™}
{* Your code for when $is_admin is equal to ā€˜1ā€™ goes here *}
{/if}

And that seemed to solve the problem (at least I can now see the edit page, weā€™ll see if there are other errors or not). Thanks a bunch. If you ever make it to Eau Claire Wisconsin, you have a cold beer waiting for you

2 Likes

One last {php} tag found and fixed.
This fix should :pray: be included in the next hotfix maintenance release of 7.x:

Hey! I should get the thanks! :wink:

1 Like

Absolutely, thanks for making the post and thanks for your help in my attempt to make this work. It seems there are other issues to get fixed as well however I am hopeful my migration from 7.12 to 7.14 will bear fruition. Thank you very much

I have made these changes for v7.14 and QR&R. But I have the below error in the crm log.

Exception handling in /var/www/html/suitecrm/include/MVC/Controller/SugarController.php:397

Exception in Controller: Syntax error in template "file:/var/www/html/suitecrm/cache/themes/SuiteP/modules/Opportunities/DetailView.tpl"  on line 1209 "{php} require_once('modules/FileField/license/OutfittersLicense.php');if(FFOutfittersLicense::isValid('FileField') !== true) { {/php}<p class='error'>File Field: Invalid <a href='index.php?module=Preview_Image_files&action=license&checklicense=file-field' >license</a></p>{php} } else { {/php}" unknown tag 'php'

To get this working, contact Outfitters tech support, or the maker of the Outfitters module ā€œFileFieldā€ tech support, give them a link to your comment, and ask them to update their module to be compatible with Smarty 3.1+ (they must find all the smarty {php} tags in their module, and replace them with alternative methods, see Smarty developer documentation).

Got it! Thanks for direction :sparkles: :v:

After i upgraded the SuiteCRM version from 7.13.2 to 7.14.3
I have faced almost same issue in my local server.

Tue Jun 25 15:44:39 2024 [1062][4452552d-a167-1d5f-0c05-619ccb21d592][FATAL] Exception handling in /websites/suitecrm/crmizmocarscom_sandbox/include/MVC/Controller/SugarController.php:397
Tue Jun 25 15:44:39 2024 [1062][4452552d-a167-1d5f-0c05-619ccb21d592][FATAL] Exception in Controller: Syntax error in template ā€œfile:/websites/suitecrm/crmizmocarscom_sandbox/custom/themes/SuiteP/include/ListView/ListViewGeneric.tplā€ on line 13 ā€œ{php}ā€ unknown tag ā€˜phpā€™

So i did few modification in code after that everything works fine.

code changes steps are follows.

resolve the issue by removing the {php} {/php} tag code and define the variable in controller files. file names are Listed below.

i. /websites/suitecrm/crmizmocarscom_sandbox/include/MVC/View/views/

file name: view.edit.php

global $current_user; 

$this->ev->ss->assign('current_user_id', $current_user->id); 

$this->ev->ss->assign('is_admin_user', $current_user->is_admin); 

$this->ev->ss->assign('current_theme', $current_user->getPreference('user_theme')); 

Add the above code inside the public function preDisplay() function.

ii). /websites/suitecrm/crmizmocarscom_sandbox/include/MVC/View/views/view.edit.php

global $current_user; 

// Assign variables to the Smarty instance 

$this->dv->ss->assign('current_user_id', $current_user->id); 

$this->dv->ss->assign('is_admin_user', $current_user->is_admin); 

$this->dv->ss->assign('current_theme', $current_user->getPreference('user_theme')); 

Add the above code inside the public function preDisplay() function

iii). /websites/suitecrm/crmizmocarscom_sandbox/include/MVC/View/views/ view.list.php

add the below code inside the function listViewProcess().

my system configuration is

MySQL version8
PHP version 7.4.3 while upgrade and once upgraded to 7.14.3 then installed to PHP 8.1 version.

2 Likes

Hi! Thanks for this. Could you make a PR for this on Github? So that the solution could be incorporated into core code, for everyone. Thanks :tada: