From: Matthias Schmidt Date: Fri, 15 May 2015 13:46:24 +0000 (+0200) Subject: Strip newlines when compiling if conditions in templates X-Git-Tag: 2.1.4~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b223ebe9d364af7f518ff7dfbf652234391ab2a;p=GitHub%2FWoltLab%2FWCF.git Strip newlines when compiling if conditions in templates Previously, the compiler could handle most situations with newlines but had issues in certain situations with closing parentheses being followed by a newline. This case is relevant when code of multiple template listeners is inserted at the end of an if condition as the template engine concatenates template listener code by newlines. --- diff --git a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php index 7a4dfa3390..9b595d235a 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php @@ -933,7 +933,7 @@ class TemplateScriptingCompiler { */ protected function compileIfTag($tagArgs, $elseif = false) { $tagArgs = $this->replaceQuotes($tagArgs); - $tagArgs = str_replace(' ', '', $tagArgs); + $tagArgs = str_replace(array(' ', "\n"), '', $tagArgs); // split tags preg_match_all('~('.$this->conditionOperatorPattern.')~', $tagArgs, $matches);