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

3.1RC1, escape_html and |count

 
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
snaxor
Smarty n00b


Joined: 06 Jul 2011
Posts: 3

PostPosted: Wed Jul 06, 2011 6:35 pm    Post subject: 3.1RC1, escape_html and |count Reply with quote

In 3.1RC1, with escape_html set to true, the |count modifier gets applied after the htmlspecialchars in the compiled template. |count works as expected when, escape_html is false.

Php:
Code:

$smarty = new Smarty();
$smarty->escape_html = true;
$smarty->assign('test', array(1, 2, 3));
$smarty->display('test.tpl');


Template:
Code:
{$test|count}


The resulting compiled code looks like this:
Code:

<?php echo count(htmlspecialchars($_smarty_tpl->tpl_vars['test']->value, ENT_QUOTES, SMARTY_RESOURCE_CHAR_SET));?>


When it should probably look like this:
Code:

<?php echo htmlspecialchars(count($_smarty_tpl->tpl_vars['test']->value), ENT_QUOTES, SMARTY_RESOURCE_CHAR_SET);?>
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Jul 06, 2011 6:58 pm    Post subject: Reply with quote

Yes, modifier must run first.

This bug is now fixed in the SVN Smarty_3_1_DEV branch.
Back to top
View user's profile Send private message
snaxor
Smarty n00b


Joined: 06 Jul 2011
Posts: 3

PostPosted: Wed Jul 06, 2011 8:18 pm    Post subject: Reply with quote

U.Tews wrote:
This bug is now fixed in the SVN Smarty_3_1_DEV branch.


Super cool. Thanks alot.
Back to top
View user's profile Send private message
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