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

Problem with custom delimiters

 
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
liviu.gelea
Smarty Rookie


Joined: 25 Nov 2015
Posts: 16

PostPosted: Wed Nov 25, 2015 12:38 pm    Post subject: Problem with custom delimiters Reply with quote

Hi. My company uses [% and %] as delimiters.

This creates some problems in smarty 3 since the following code will fail:
Code:
[%assign var=variable value=foo%]
[%assign var=var_foo value=bar%]
[%$var_[%$variable%]%]

while this would have worked
Code:
{assign var=variable value=foo}
{assign var=var_foo value=bar}
{$var_{$variable}}


I believe this is because "[" is interpreted as array access:

Code:
Fatal error: Uncaught --> Smarty Compiler: Syntax error in template ".........\bug.inc.php" on line 3 "[%$var_[%$variable%]%]" - Unexpected "%" <-- thrown in ............\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 3
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Nov 25, 2015 8:20 pm    Post subject: Reply with quote

Thanks for bringing this up.

The fix is on github in the dev_master branch.
Back to top
View user's profile Send private message
liviu.gelea
Smarty Rookie


Joined: 25 Nov 2015
Posts: 16

PostPosted: Thu Nov 26, 2015 3:36 pm    Post subject: Thanks Reply with quote

Thanks a lot. Your fix works like a charm.
You're a lightsaber... I mean life saver. And a lightsaber.
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