diff --git a/CHANGELOG b/CHANGELOG index 0b2809d87..fa19ae4b7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ * 1.35.3 (2018-XX-XX) + * added missing else clause to avoid infinite loops * fixed .. (range operator) in sandbox policy * 1.35.2 (2018-03-03) diff --git a/lib/Twig/Lexer.php b/lib/Twig/Lexer.php index 4efdfb4ad..41211eb28 100644 --- a/lib/Twig/Lexer.php +++ b/lib/Twig/Lexer.php @@ -343,6 +343,9 @@ class Twig_Lexer implements Twig_LexerInterface $this->popState(); ++$this->cursor; + } else { + // unlexable + throw new Twig_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); } }