|
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 |
edelacruz Smarty Rookie
Joined: 10 May 2010 Posts: 25
|
Posted: Sun May 29, 2016 2:06 pm Post subject: escape modifier exception 3.1.29 |
|
|
PHP exception
syntax error, unexpected '" => "' (T_CONSTANT_ENCAPSED_STRING), expecting ')'
in C:\MyTempFolder\TemplateCompiles\580e5562735edfe8faf691d25fa06e38e1798abf_0.file.Product.tpl.cache.php at line 2635
.tpl contents causing the problem:
Code: | {foreach $MARKET_PRODUCT->GetBestDeals() as $PRODUCT_DEAL_INFO}
clientController.ShowDealTile('{$PRODUCT_DEAL_INFO->Get_Title()|escape:javascript}', '{$PRODUCT_DEAL_INFO->GetPageUrl()}', '{$PRODUCT_DEAL_INFO->GetDefaultImageUrl()}');
{/foreach} |
580e5562735edfe8faf691d25fa06e38e1798abf_0.file.Product.tpl.cache.php at line 2635: Code: | clientController.ShowDealTile('<?php echo strtr($_smarty_tpl->tpl_vars['PRODUCT_DEAL_INFO']->value->Get_Title(), array("\\\\" => "\\\\\\\\", "'" => "\\\'", "\\"" => "\\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\\n", "</" => "<\\/" ));?> |
As you can see, it seems that the escape modifier is generating faulty PHP code because of how it is escaping double-quotes.
I took a look at the modifier's source code, and it seems fine.
Code: | return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\/'));
|
It must be that during compiling or caching, the extra slashes are added and this is causing the issue? Or am I somehow causing the extra slashes? It's late and I'm a bit tired so apologies in advance if this is my mistake.
Thanks.
EDIT: I did not have this issue with 3.1.21. I have not tried the versions in-between. |
|
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
|