Re: Evil e

bertrand Gugger <[email protected]> Thu, 08 Feb 2007 21:07:55 +0100
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Danilo Buerger wrote:
> I suggest applying the following patch to prevent 2 problems:
> a) Using the "e" pattern modifier is nearly as evil as programming cobol

COBOL is nice , definitively structured.

modifier e is worse than evil.

> b) If one of the delimiters is set to "'" it could get really ugly

Hears nice to forbid it or at least nicely do nothing on this

I did not look into the patch just react to the concepts here.
--
toggg

> 
> Index: Smarty_Compiler.class.php
> ===================================================================
> RCS file: /repository/smarty/libs/Smarty_Compiler.class.php,v
> retrieving revision 1.386
> diff -r1.386 Smarty_Compiler.class.php
> 268,273c270,279
> <         $source_content = preg_replace($search.'e', "'"
> <                                        . 
> $this->_quote_replace($this->left_delimiter) . 'php'
> <                                        . "' . str_repeat(\"\n\", 
> substr_count('\\0', \"\n\")) .'"
> <                                        . 
> $this->_quote_replace($this->right_delimiter)
> <                                        . "'"
> <                                        , $source_content);
> ---
>  >         $source_content = preg_replace_callback(
>  >             $search,
>  >             create_function(
>  >                 '$matches',
>  >                 'return \'' . addslashes($this->left_delimiter) . 'php'
>  >                 . '\' . str_repeat("\n", substr_count($matches[0], 
> "\n")) . \''
>  >                 . addslashes($this->right_delimiter) . '\';'
>  >             ),
>  >             $source_content
>  >         );

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php