mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-07 16:06:53 +00:00
Fix ambiguous syntax parsing
This commit is contained in:
+2
-1
@@ -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
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
not
|
||||
--TEMPLATE--
|
||||
{{ (not false) ? 'OK' : 'KO' }}
|
||||
{{ not false ? 'OK' : 'KO' }}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
OK
|
||||
OK
|
||||
Reference in New Issue
Block a user