Jeff-Lewis / smarty-php

Automatically exported from code.google.com/p/smarty-php
0 stars 0 forks source link

Add nl2br to $php_modifiers in include/lib/smarty3/sysplugins/smarty_security.php #223

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use code like {$Name|nl2br}
2. $smarty->enableSecurity();

What is the expected output? What do you see instead?
( ! ) Fatal error: Uncaught --> Smarty Compiler: Syntax error in template 
"./templates/index.tpl" on line 22 "<b>{$Name|nl2br}</b>" modifier 'nl2br' not 
allowed by security setting <-- thrown in 
/public_html/Smarty-3.1.21/libs/sysplugins/smarty_internal_templatecompilerbase.
php on line 22

What version of the product are you using? On what operating system?
Smarty-3.1.21/demo/index.php

Please provide any additional information below.
Patch

index 9f7183b..caae8e8 100644
--- a/include/lib/smarty3/sysplugins/smarty_security.php
+++ b/include/lib/smarty3/sysplugins/smarty_security.php
@@ -74,7 +74,6 @@ class Smarty_Security
         'count', 'sizeof',
         'in_array', 'is_array',
         'time',
-        'nl2br',
     );
     /**
      * This is an array of trusted PHP modifiers.
@@ -85,7 +84,8 @@ class Smarty_Security
      */
     public $php_modifiers = array(
         'escape',
-        'count'
+        'count',
+        'nl2br',
     );
     /**
      * This is an array of allowed tags.

Original issue reported on code.google.com by a...@x-cart.com on 2 Feb 2015 at 12:51

GoogleCodeExporter commented 9 years ago
This fix is now on Github at https://github.com/smarty-php/smarty in the master 
branch.
It will be included later in the 3.1.14 release.

Preferred location to report issues will be 
https://github.com/smarty-php/smarty/issues 

Original comment by Uwe.Tews@googlemail.com on 13 May 2015 at 6:19

GoogleCodeExporter commented 9 years ago
Thank you.

Original comment by a...@x-cart.com on 14 May 2015 at 5:49