diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-11-04 12:21:12 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-11-04 12:21:12 -0600 |
commit | b49d3a1851330d64009c8050132e50b093172559 (patch) | |
tree | e1fe8c7826faeddaf7f8044bd885520fdfb02878 | |
parent | c609f25bae6aee2b7fab8dfeb8b3a58e2c2f396f (diff) | |
download | forums-b49d3a1851330d64009c8050132e50b093172559.tar forums-b49d3a1851330d64009c8050132e50b093172559.tar.gz forums-b49d3a1851330d64009c8050132e50b093172559.tar.bz2 forums-b49d3a1851330d64009c8050132e50b093172559.tar.xz forums-b49d3a1851330d64009c8050132e50b093172559.zip |
[ticket/11943] Do not quote the value when it is exactly true, false, or null
Quoting these can change the meaning of the value (e.g. 'false' == true)
PHPBB3-11943
-rw-r--r-- | phpBB/phpbb/template/twig/lexer.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index be53b3eb5b..8c52fa65b2 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -129,6 +129,14 @@ class lexer extends \Twig_Lexer // Replace template variables with start/end to parse variables (' ~ TEST ~ '.html) $matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]); + // If the second item is exactly one of a few key words, + // do not quote it as it changes the meaning + // http://tracker.phpbb.com/browse/PHPBB3-11943 + if (in_array($matches[2], array('false', 'true', 'null'))) + { + return "<!-- {$matches[1]} {$matches[2]} -->"; + } + // Surround the matches in single quotes ('' ~ TEST ~ '.html') return "<!-- {$matches[1]} '{$matches[2]}' -->"; }; |