Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

2.6.26: bug with modifiers

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
qFox
Smarty n00b


Joined: 02 Feb 2010
Posts: 1

PostPosted: Tue Feb 02, 2010 1:13 pm    Post subject: 2.6.26: bug with modifiers Reply with quote

I can't really believe this bug was not caught during testing, but it seems to me that modifiers can't generally be used at all because the compiled file will be missing a dollar sign...

Source: Smarty_Compiler.class.php

Replace the following at line 1959:

$output = "( (isset(".substr($output,1).") || \$_tmp = '') && (is_array(\$_tmp=$output))? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))";

to

$output = "( (isset(".$output.") || \$_tmp = '') && (is_array(\$_tmp=$output))? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))";

In short, replace the first "substr($output,1)" by "$output". Problem solved (but how many new ones am I introducing this way?)

Again, I can't really believe nobody caught this, but it was preventing me from using something like {$var|substr:0:5}

My setup isn't weird, only I use backticks instead of curly braces.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Mar 19, 2010 9:29 am    Post subject: Reply with quote

Modifiers work pretty fine for me in Smarty-2.6.26 regardless of curly braces or back-ticks or whatever as delimiters.

You must have some other screw-up in your setup.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs 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