From: Alexander Ebert Date: Tue, 21 Jun 2016 13:06:55 +0000 (+0200) Subject: ignore `{}` during template compilation X-Git-Tag: 3.0.0_Beta_1~1382 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ffe057d3a3f736d57fdb870f6af821b4ec5ec2f0;p=GitHub%2FWoltLab%2FWCF.git ignore `{}` during template compilation This avoids empty JavaScript object literals being recognized as template scripting tags --- 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"); }