From b90563045e355dc8b8f9f83b05e7847a73da24f5 Mon Sep 17 00:00:00 2001 From: mohrt Date: Fri, 23 Feb 2007 19:40:01 +0000 Subject: [PATCH] escape creating of language=php from interleaving --- libs/Smarty_Compiler.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 0612acd7..1f490fde 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -281,7 +281,7 @@ class Smarty_Compiler extends Smarty { /* loop through text blocks */ for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) { /* match anything resembling php tags */ - if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?php[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) { + if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?\s*php\s*[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) { /* replace tags with placeholders to prevent recursive replacements */ $sp_match[1] = array_unique($sp_match[1]); usort($sp_match[1], '_smarty_sort_length'); @@ -307,7 +307,7 @@ class Smarty_Compiler extends Smarty { } } } - + /* Compile the template tags into PHP code. */ $compiled_tags = array(); for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) { @@ -369,10 +369,12 @@ class Smarty_Compiler extends Smarty { } $compiled_content .= str_replace('\n",$compiled_content); + $compiled_content = preg_replace("~(?\n",$compiled_content); + // recover legit tags - $compiled_content = str_replace($tmp_id,'