diff --git a/changelog/930.md b/changelog/930.md new file mode 100644 index 00000000..d9af7c2a --- /dev/null +++ b/changelog/930.md @@ -0,0 +1 @@ +- Fix incorrect compilation of expressions when escape_html=true [#930](https://github.com/smarty-php/smarty/pull/930) \ No newline at end of file diff --git a/src/Compile/PrintExpressionCompiler.php b/src/Compile/PrintExpressionCompiler.php index 99a03901..486512d4 100644 --- a/src/Compile/PrintExpressionCompiler.php +++ b/src/Compile/PrintExpressionCompiler.php @@ -84,7 +84,7 @@ class PrintExpressionCompiler extends Base { } if ($compiler->getTemplate()->getSmarty()->escape_html) { - $output = "htmlspecialchars((string) {$output}, ENT_QUOTES, '" . addslashes(\Smarty\Smarty::$_CHARSET) . "')"; + $output = "htmlspecialchars((string) ({$output}), ENT_QUOTES, '" . addslashes(\Smarty\Smarty::$_CHARSET) . "')"; } }