diff --git a/NEWS b/NEWS index df9c9075..61ec68fd 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ +- fix php handling (monte, boots, danilo) - fix handling of plugin tags directly followed by an else tag (Fahr, danilo) - fix handling of $etc in the truncate modifier when $etc is longer than $length (Sylvinus, messju) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index b404b9f4..3a9b86a9 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -240,9 +240,6 @@ class Smarty_Compiler extends Smarty { $ldq = preg_quote($this->left_delimiter, '~'); $rdq = preg_quote($this->right_delimiter, '~'); - /* un-hide hidden xml open tags */ - $source_content = preg_replace("~<({$ldq}(.*?){$rdq}\?)~s", '< \\1', $source_content); - // run template source through prefilter functions if (count($this->_plugins['prefilter']) > 0) { foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { @@ -353,7 +350,7 @@ class Smarty_Compiler extends Smarty { } $compiled_content = ''; - $tmp_id = '{'.md5(uniqid(rand(), true)).'}'; + $tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . '%%%'; /* Interleave the compiled contents and text blocks to get the final result. */ for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) { @@ -362,19 +359,19 @@ class Smarty_Compiler extends Smarty { $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]); } // replace legit PHP tags with placeholder - $text_blocks[$i] = str_replace('\n",$compiled_content); - $compiled_content = preg_replace("~(?\n",$compiled_content); - + $compiled_content = str_replace('\n", $compiled_content); + $compiled_content = preg_replace("~(?\n", $compiled_content); + // recover legit tags - $compiled_content = str_replace($tmp_id,'_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content; } -/* - // remove unnecessary close/open tags - $compiled_content = preg_replace('~\?>\n?<\?php~', '', $compiled_content); -*/ - // run compiled template through postfilter functions if (count($this->_plugins['postfilter']) > 0) { foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {