diff options
author | David King <imkingdavid@gmail.com> | 2013-09-12 21:17:22 -0700 |
---|---|---|
committer | David King <imkingdavid@gmail.com> | 2013-09-12 21:17:22 -0700 |
commit | f02a8cf0e63c4107550fc4d9d973c34ffbfe0e03 (patch) | |
tree | 777acea635ffab50fb21ebfc07fdf8e0f39fdab8 /phpBB/phpbb/template | |
parent | 70399fe66d559ddfccb5e5ebfa5c340ca4c90313 (diff) | |
parent | 5166240d628e19ba0db13e5dc0de8153e80d4c44 (diff) | |
download | forums-f02a8cf0e63c4107550fc4d9d973c34ffbfe0e03.tar forums-f02a8cf0e63c4107550fc4d9d973c34ffbfe0e03.tar.gz forums-f02a8cf0e63c4107550fc4d9d973c34ffbfe0e03.tar.bz2 forums-f02a8cf0e63c4107550fc4d9d973c34ffbfe0e03.tar.xz forums-f02a8cf0e63c4107550fc4d9d973c34ffbfe0e03.zip |
Merge pull request #1705 from EXreaction/ticket/11833
Fix invalid template loop & prevent Twig from throwing errors in invalid uses of BEGINELSE
Diffstat (limited to 'phpBB/phpbb/template')
-rw-r--r-- | phpBB/phpbb/template/twig/lexer.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index d47162951d..8b72a06642 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 <!-- BEGINELSE --> + $body = str_replace('<!-- BEGINELSE -->', '{% else %}', $body); + // Is the designer wanting to call another loop in a loop? // <!-- BEGIN loop --> // <!-- BEGIN !loop2 --> @@ -205,9 +208,6 @@ class phpbb_template_twig_lexer extends Twig_Lexer return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; - // Replace <!-- BEGINELSE --> correctly, only needs to be done once - $code = str_replace('<!-- BEGINELSE -->', '{% else %}', $code); - return preg_replace_callback('#<!-- BEGIN ([!a-zA-Z0-9_]+)(\([0-9,\-]+\))? -->(.+?)<!-- END \1 -->#s', $callback, $code); } |