[ticket/11701] Refix regex for appending |length

PHPBB3-11701
This commit is contained in:
Nathaniel Guse 2013-07-19 12:43:24 -05:00 committed by Nathan Guse
parent 2d764ef7d5
commit ea250a5ef5

View file

@ -226,10 +226,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer
$inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner); $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner);
// Replace .foo with loops.foo|length // Replace .foo with loops.foo|length
$inner = preg_replace('#\s\.([a-zA-Z_0-9]+) #', ' loops.$1|length ', $inner); $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', ' loops.$1|length$2', $inner);
// Replace .foo.bar with foo.bar|length // Replace .foo.bar with foo.bar|length
$inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+) #', ' $1|length ', $inner); $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', ' $1|length$2', $inner);
return "<!-- {$matches[1]}IF{$inner}-->"; return "<!-- {$matches[1]}IF{$inner}-->";
}; };