mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/11701] Fix loops var check
PHPBB3-11701
This commit is contained in:
committed by
Nathan Guse
parent
0d31420ae0
commit
c0b9db1c62
@@ -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}-->";
|
||||
|
Reference in New Issue
Block a user