Fix ambiguous syntax parsing

This commit is contained in:
Fabien Potencier
2020-02-23 09:40:57 +01:00
parent 5724cbeddf
commit 5663351a49
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -506,8 +506,9 @@ class Lexer implements \Twig_LexerInterface
}
// an operator that begins with a character must have a space before
// or a parenthesis
if (ctype_alpha($operator[0])) {
$r = '(?<=\s)'.$r;
$r = '(?<=[\s(])'.$r;
}
// an operator with a space can be any amount of whitespaces
+10
View File
@@ -0,0 +1,10 @@
--TEST--
not
--TEMPLATE--
{{ (not false) ? 'OK' : 'KO' }}
{{ not false ? 'OK' : 'KO' }}
--DATA--
return []
--EXPECT--
OK
OK