From ffe057d3a3f736d57fdb870f6af821b4ec5ec2f0 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 21 Jun 2016 15:06:55 +0200 Subject: [PATCH] ignore `{}` during template compilation This avoids empty JavaScript object literals being recognized as template scripting tags --- .../template/TemplateScriptingCompiler.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php index 6b709f81e0..f23793bb4e 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php @@ -239,7 +239,16 @@ class TemplateScriptingCompiler { $compiledTags = []; for ($i = 0, $j = count($templateTags); $i < $j; $i++) { $this->currentLineNo += mb_substr_count($textBlocks[$i], "\n"); - $compiledTags[] = $this->compileTag($templateTags[$i], $identifier, $metaData); + + if ($templateTags[$i] === '') { + // avoid empty JavaScript object literals being recognized + // as template scripting tags + $compiledTags[] = '{}'; + } + else { + $compiledTags[] = $this->compileTag($templateTags[$i], $identifier, $metaData); + } + $this->currentLineNo += mb_substr_count($templateTags[$i], "\n"); } -- 2.20.1