|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
qFox Smarty n00b
Joined: 02 Feb 2010 Posts: 1
|
Posted: Tue Feb 02, 2010 1:13 pm Post subject: 2.6.26: bug with modifiers |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Mar 19, 2010 9:29 am Post subject: |
|
|
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 |
|
|
|
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
|