bug #3401 Fix missing delimiter for preg_quote in lexer (waitxd)

This PR was submitted for the 3.x branch but it was merged into the 1.x branch instead.

Discussion
----------

Fix missing delimiter for preg_quote in lexer

Is is a really edge case (PHP < 7.3 and '#' as whitespace_trim symbol), but for the sake of consistency here's a proper fix.

Commits
-------

41605057 Fix missing delimiter for preg_quote in lexer
This commit is contained in:
Fabien Potencier
2020-09-27 06:58:47 +02:00
+1 -1
View File
@@ -117,7 +117,7 @@ class Lexer implements \Twig_LexerInterface
// #}
'lex_comment' => '{
(?:'.
preg_quote($this->options['whitespace_trim']).preg_quote($this->options['tag_comment'][1], '#').'\s*\n?'. // -#}\s*\n?
preg_quote($this->options['whitespace_trim'].$this->options['tag_comment'][1], '#').'\s*\n?'. // -#}\s*\n?
'|'.
preg_quote($this->options['whitespace_line_trim'].$this->options['tag_comment'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~#}[ \t\0\x0B]*
'|'.