From 5166240d628e19ba0db13e5dc0de8153e80d4c44 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 9 Sep 2013 11:26:40 -0500 Subject: [ticket/11833] Prevent Twig errors from invalid template loops using BEGINELSE PHPBB3-11833 --- phpBB/phpbb/template/twig/lexer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/template') diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 7ab569313c..ba822e7545 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -161,6 +161,9 @@ class phpbb_template_twig_lexer extends Twig_Lexer $subset = trim(substr($matches[2], 1, -1)); // Remove parenthesis $body = $matches[3]; + // Replace + $body = str_replace('', '{% else %}', $body); + // Is the designer wanting to call another loop in a loop? // // @@ -205,9 +208,6 @@ class phpbb_template_twig_lexer extends Twig_Lexer return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; - // Replace correctly, only needs to be done once - $code = str_replace('', '{% else %}', $code); - return preg_replace_callback('#(.+?)#s', $callback, $code); } -- cgit v1.2.1