|
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 |
Insomniac Smarty Rookie
Joined: 07 Apr 2012 Posts: 6
|
Posted: Sat Apr 07, 2012 1:19 am Post subject: escape:'javascript' bug |
|
|
I've just recently upgraded from 3.0.X to 3.1.8 (yeah I know, kinda lazy) and run into what appears to be an javascript escape bug.
The code that is bugging out is just:
var address = '{$address|escape:'javascript'}';
This used to work fine until I updated. Now it results in:
[07-Apr-2012 01:06:53 UTC] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /domain/project/.smarty/templates_c/cf8565858795dac5032f8acef6d6d90aecff0674.file.index.tpl.cache.php on line 220
When I get rid of the 'javascript' the script is unbroken, but obviously it's defaulting. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Apr 07, 2012 5:26 pm Post subject: |
|
|
I can't reproduce the problem.
How does line 220 in /domain/project/.smarty/templates_c/cf8565858795dac5032f8acef6d6d90aecff0674.file.index.tpl.cache.php look like? |
|
Back to top |
|
Insomniac Smarty Rookie
Joined: 07 Apr 2012 Posts: 6
|
Posted: Sat Apr 07, 2012 7:48 pm Post subject: |
|
|
Exact line of the template
Code: | var address = '{$address|escape:'javascript'}'; |
Compiled code:
Code: | var address = '<?php echo '/*%%SmartyNocache:10677328934f8099498848b1-39097272%%*/<?php echo strtr($_smarty_tpl->tpl_vars[\'address\']->value, array("\\\" => "\\\\\\", "\'" => "\\\\'", "\"" => "\\\\"", "\r" => "\\\r", "\n" => "\\\n", "</" => "<\/" ));?>
/*/%%SmartyNocache:10677328934f8099498848b1-39097272%%*/';?>
';
|
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Apr 08, 2012 12:10 pm Post subject: |
|
|
This bug did occur within nocache sections.
The fix is now in the SVN trunk and will later be included in 3.1.9 |
|
Back to top |
|
Insomniac Smarty Rookie
Joined: 07 Apr 2012 Posts: 6
|
Posted: Sun Apr 08, 2012 9:03 pm Post subject: |
|
|
Thanks for that. I tried searching for a reference to the bug, but no luck. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Apr 09, 2012 10:18 am Post subject: |
|
|
The error was not directly related to the escape modifier but the nocache code compiler.
- bugfix "\\" was not escaped correctly when generating nocache code (Forum Topic 21364) |
|
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
|