From 865ce0b67f50f2bdba29717c1241f8b45826d777 Mon Sep 17 00:00:00 2001 From: think-mcunanan Date: Thu, 26 Aug 2021 12:39:51 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Redmine-#5313:[=E3=83=AC=E3=82=B9=E3=83=9D?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E6=94=B9=E5=96=84]=20=E3=82=B5=E3=83=BC?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B5=E3=82=A4=E3=83=89=E3=82=92PHP5?= =?UTF-8?q?=E2=86=92PHP7=E3=81=AB=E3=82=A2=E3=83=83=E3=83=97=E3=82=B0?= =?UTF-8?q?=E3=83=AC=E3=83=BC=E3=83=89=E3=81=99=E3=82=8B=20-=20replace=20c?= =?UTF-8?q?ode=20that=20is=20not=20working=20properly=20in=20PHP7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendors/smarty/Smarty_Compiler.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vendors/smarty/Smarty_Compiler.class.php b/vendors/smarty/Smarty_Compiler.class.php index 1178b84d0..aeffe28d9 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 "{php}"; + }, + $source_content + ); /* Gather all template tags. */ preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match); From 927432f0e4af2e80eb9607cc448c9ad823687db8 Mon Sep 17 00:00:00 2001 From: think-mcunanan Date: Thu, 26 Aug 2021 16:04:55 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Redmine-#5313:[=E3=83=AC=E3=82=B9=E3=83=9D?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E6=94=B9=E5=96=84]=20=E3=82=B5=E3=83=BC?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B5=E3=82=A4=E3=83=89=E3=82=92PHP5?= =?UTF-8?q?=E2=86=92PHP7=E3=81=AB=E3=82=A2=E3=83=83=E3=83=97=E3=82=B0?= =?UTF-8?q?=E3=83=AC=E3=83=BC=E3=83=89=E3=81=99=E3=82=8B=20-=20update=20pr?= =?UTF-8?q?eg=5Freplace=5Fcallback=20call=20back=20function=20to=20make=20?= =?UTF-8?q?the=20same=20with=20the=20old=20code.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendors/smarty/Smarty_Compiler.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vendors/smarty/Smarty_Compiler.class.php b/vendors/smarty/Smarty_Compiler.class.php index aeffe28d9..7daab34c3 100644 --- a/vendors/smarty/Smarty_Compiler.class.php +++ b/vendors/smarty/Smarty_Compiler.class.php @@ -263,11 +263,11 @@ function _compile_file($resource_name, $source_content, &$compiled_content) /* replace special blocks by "{php}" */ $source_content = preg_replace_callback( - $search, - function ($match) { - return "{php}"; - }, - $source_content + $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. */