Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Modifier applied twice to nested elements

 
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Fri Dec 21, 2012 10:31 pm    Post subject: Modifier applied twice to nested elements Reply with quote

The following code:
{setfilter escape:"html"}{"{"&"}"}{/setfilter}
outputs:
&

Evidently, filter is applied first to inner string and then to outer string (i.e. {"{"&"|escape:"html"}"|escape:"html"}). In my opinion, this is not desired behavior. I would expect it to apply only to the outer bracket (i.e. {"{"&"}"|escape:"html"}).

The same problem with escape_html option. It escapes {"{"&"}"} code twice producing & . I can't imagine situation when somebody would want such double escapes.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sun Dec 23, 2012 7:49 pm    Post subject: Reply with quote

The filter does run on each tag which does create output. In this case the output of the inner tag is captured and used as input for the outer tag. So we got double escaping.

I will put this on the to do for 3.2
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests 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