mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[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
This commit is contained in:
parent
c609f25bae
commit
b49d3a1851
1 changed files with 8 additions and 0 deletions
|
@ -129,6 +129,14 @@ class lexer extends \Twig_Lexer
|
||||||
// Replace template variables with start/end to parse variables (' ~ TEST ~ '.html)
|
// Replace template variables with start/end to parse variables (' ~ TEST ~ '.html)
|
||||||
$matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]);
|
$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')
|
// Surround the matches in single quotes ('' ~ TEST ~ '.html')
|
||||||
return "<!-- {$matches[1]} '{$matches[2]}' -->";
|
return "<!-- {$matches[1]} '{$matches[2]}' -->";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue