| Danilo Buerger 2007-05-14, 8:08 am |
| Hey.
I am not able to reproduce this. Could you please submit a working
sample? And yes, this should go to the dev list if you think its a bug.
Bye.
Artemy Tregoubenko schrieb:
> Hello everyone.
>
> I just tried to use this nice feature of smarty:
> http://smarty.php.net/manual/en/var...t.modifiers.php
> I think that auto-escaping of all values when outputting them is a great
> idea, so i set $this->default_modifiers = array('escape:"html"');
>
> It worked nice until I tried to use foreach to iterate over array of
> arrays. I got lots of messages like this:
> Warning: htmlspecialchars() expects parameter 1 to be string, array
> given...
>
> The same warnings were displayed when using "{if $array}".
>
> I looked into compiled templates and found that smarty applies default
> modifiers to all parameters of foreach, including
> "from=$array_of_arrays", and this generates warning.
>
> Hiding warnings is a bad practice, so I'm looking for another solution
> for this problem. By now I hacked _compile_foreach_start and
> _compile_if_tag so that default_modifiers are toggled off in the
> beginning and restored at the end of methods. I understand this is only
> partial solution.
>
> Can anyone, having deeper knowledge of smarty compiler, suggest better
> way to fix this?
> Or should I write about my problem to dev list?
>
|