diff --git a/vendors/smarty/Smarty_Compiler.class.php b/vendors/smarty/Smarty_Compiler.class.php index 1178b84d0..7daab34c3 100644 --- a/vendors/smarty/Smarty_Compiler.class.php +++ b/vendors/smarty/Smarty_Compiler.class.php @@ -262,12 +262,13 @@ function _compile_file($resource_name, $source_content, &$compiled_content) reset($this->_folded_blocks); /* replace special blocks by "{php}" */ - $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, + function ($match) { + return $this->_quote_replace($this->left_delimiter) . "php" . str_repeat("\n", substr_count($match[0], "\n")) . $this->_quote_replace($this->right_delimiter); + }, + $source_content + ); /* Gather all template tags. */ preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);