Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

upgrading 2.6.28 to 3.1.21

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
shwekhaw
Smarty Rookie


Joined: 07 Apr 2005
Posts: 10

PostPosted: Tue May 28, 2019 2:18 am    Post subject: upgrading 2.6.28 to 3.1.21 Reply with quote

Hi. I am moving the site from 2.6.28 to 3.1.21 I am getting fatal php error for substr modifier in in variables with $variable|substr due to security. Is there work around to this?

Also I have noticed that variables in the format { $variable } will no longer work in 3.1.21 unless I remove spaces and change to {$variable}. Those variable were fine under 2.6.28
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1532

PostPosted: Tue May 28, 2019 4:53 am    Post subject: Reply with quote

Quote:
I am getting fatal php error for substr modifier in in variables with $variable|substr due to security.

What is the error text?

Quote:
I have noticed that variables in the format { $variable } will no longer work in 3.1.21 unless I remove spaces and change to {$variable}

Of course. Read the documentation, it should have never been written as "{ $variable }" in first place.
Back to top
View user's profile Send private message
shwekhaw
Smarty Rookie


Joined: 07 Apr 2005
Posts: 10

PostPosted: Tue May 28, 2019 6:26 am    Post subject: Reply with quote

[quote="AnrDaemon"]
Quote:
I am getting fatal php error for substr modifier in in variables with $variable|substr due to security.

What is the error text?
It is as follows.
[28-May-2019 03:17:26 UTC] PHP Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "/var/www/vhosts/xxxxxxxxxxxxxxxorder_PO_v2.tpl" on line 313 "<TD height="16" align="left" valign="middle" class="prData">{$product.productcode|substr:3}</TD>" modifier 'substr' not allowed by security setting <--
thrown in /var/www/vhostsxxxxxxxxxx/smarty_internal_templatecompilerbase.php on line 313
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1532

PostPosted: Thu May 30, 2019 8:21 pm    Post subject: Reply with quote

So, your website uses https://www.smarty.net/docs/en/advanced.features.tpl#advanced.features.security

Read the docs on how to tweak the class to allow wished modifiers, or to disable security handler altogether, if your website does not allow template editing by the users.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP