From 1fb0f9701d8443083495cd2645e8a0c45d54c34d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 14 May 2019 08:10:36 +0200 Subject: [PATCH] fixed PHP 7.4 support --- CHANGELOG | 1 + src/Lexer.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index d6bd7de72..b14edf9c6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ * 1.41.0 (2019-XX-XX) + * fixed support for PHP 7.4 * added "filter", "map", and "reduce" filters (and support for arrow functions) * fixed partial output leak when a PHP fatal error occurs * optimized context access on PHP 7.4 diff --git a/src/Lexer.php b/src/Lexer.php index 7cead8340..8cae3597f 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -262,7 +262,7 @@ class Lexer implements \Twig_LexerInterface if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) { // whitespace_trim detected ({%-, {{- or {#-) $text = rtrim($text); - } else { + } elseif ($this->options['whitespace_line_trim'] === $this->positions[2][$this->position][0]) { // whitespace_line_trim detected ({%~, {{~ or {#~) // don't trim \r and \n $text = rtrim($text, " \t\0\x0B");