Re: [SMARTY-GENERAL] Smarty 2.0.1 - a bug (security + debugging) and a recommendation
| From: | Andrei Zmievski | Date: | Wed, 03 Apr 2002 19:34:09 +0000 |
| Subject: | Re: [SMARTY-GENERAL] Smarty 2.0.1 - a bug (security + debugging) and a recommendation | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3470@lists.php.net to get a copy of this message | ||
On Wed, 03 Apr 2002, Bogien wrote:
> Hello!
>
> 1. I think I've found a bug:
>
> In the latest version of Smarty (2.0.1), when I mix debugging with
> security, I get the following errors:
>
> > Warning: Undefined offset: 3 in c:\program files\apache >
> > group\apache\htdocs\Smarty_Compiler.class.php on line 859
>
> This is the effect of adding a line "$smarty->security = true;"
> to the file "index.php" which comes bundled with Smarty-2.0.1.tar.gz.
> Errors appear only in the main browser window - the debugging console
> pops up and displays correctly.
>
> How to fix this issue?
This has something to do with one of the {if} tags in your template. Can
you try eliminating them one by one until the message disappears and the
post the offending one?
> 2. A recommendation - I think that it can be useful to add something like
> "default/global modifiers" - functions that will be applied to all the
> Smarty variables in the template. It is pretty tiring to write:
>
> > blah blah blah {$text1|htmlspecialchars}
> > {$text2|htmlspecialchars} {$text3|htmlspecialchars}
> > abc def {$text4|htmlspecialchars} 123
>
> It would be nice to store the data in the database "as they are" and
> then escape < > chars with some global/default modifier function.
It might be nice, but there are problems with this approach. First of
all, you wouldn't be able to use a non-modified variable for any purpose
because there would be no way to specify it as such. Secondly, the
default modifier would have to come either as the very first modifier or
as the very last one. Which approach is correct is not clear.
-Andrei
"I still find each day too short for all the thoughts I want to think,
all the walks I want to take, all the books I want to read, and all the
friends I want to see."
-John Burroughs