diff options
author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-07-14 14:10:11 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-07-23 09:26:50 -0500 |
commit | c0b9db1c626c88780b2ee5f5a237561a125c54aa (patch) | |
tree | 4ba9af94d6d7c2aa2aef8baa580dface68d00bfd /phpBB/phpbb | |
parent | 0d31420ae099b9284c6240bfbda0f03f1be155c1 (diff) | |
download | forums-c0b9db1c626c88780b2ee5f5a237561a125c54aa.tar forums-c0b9db1c626c88780b2ee5f5a237561a125c54aa.tar.gz forums-c0b9db1c626c88780b2ee5f5a237561a125c54aa.tar.bz2 forums-c0b9db1c626c88780b2ee5f5a237561a125c54aa.tar.xz forums-c0b9db1c626c88780b2ee5f5a237561a125c54aa.zip |
[ticket/11701] Fix loops var check
PHPBB3-11701
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/template/twig/lexer.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php index 3c072adff9..4f127bd7e6 100644 --- a/phpBB/phpbb/template/twig/lexer.php +++ b/phpBB/phpbb/template/twig/lexer.php @@ -200,8 +200,9 @@ class phpbb_template_twig_lexer extends Twig_Lexer $subset = '|subset(' . $subset . ')'; } + $parent = ($parent) ?: 'loops.'; // Turn into a Twig for loop - return "{% for {$name} in loops.{$parent}{$name}{$subset} %}{$body}{% endfor %}"; + return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; // Replace <!-- BEGINELSE --> correctly, only needs to be done once @@ -224,7 +225,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace $TEST with definition.TEST $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); - // Replace .test with test|length + // Replace .foo with loops.foo|length + $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)#', ' loops.$1|length', $inner); + + // Replace .foo.bar with foo.bar|length $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $inner); return "<!-- {$matches[1]}IF{$inner}-->"; |