aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-08-29 09:19:14 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2013-08-29 10:00:24 -0500
commit62e81d174d9d3dbd78baea36425720ed0fdaffb1 (patch)
tree3612f64fd9e6ee1ae1fd0ccb2b69810bac4de294 /phpBB/phpbb
parentMerge remote-tracking branch 'remotes/brunoais/ticket/11803' into develop (diff)
downloadphpbb-62e81d174d9d3dbd78baea36425720ed0fdaffb1.tar.gz
phpbb-62e81d174d9d3dbd78baea36425720ed0fdaffb1.tar.bz2
phpbb-62e81d174d9d3dbd78baea36425720ed0fdaffb1.zip
[ticket/11816] Fix define/loop checks in IF statements containing parenthesis
PHPBB3-11816
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/template/twig/lexer.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 3534311b7a..719066b659 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -223,13 +223,13 @@ class phpbb_template_twig_lexer extends Twig_Lexer
{
$inner = $matches[2];
// Replace $TEST with definition.TEST
- $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner);
+ $inner = preg_replace('#(\s\(?!?)\$([a-zA-Z_0-9]+)#', '$1definition.$2', $inner);
// Replace .foo with loops.foo|length
- $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', ' loops.$1|length$2', $inner);
+ $inner = preg_replace('#(\s\(?!?)\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', '$1loops.$2|length$3', $inner);
// Replace .foo.bar with foo.bar|length
- $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', ' $1|length$2', $inner);
+ $inner = preg_replace('#(\s\(?!?)\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', '$1$2|length$3', $inner);
return "<!-- {$matches[1]}IF{$inner}-->";
};
@@ -237,7 +237,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer
// Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces)
$code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code);
- return preg_replace_callback('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
+ return preg_replace_callback('#<!-- (ELSE)?IF((.*) \(?!?[\$|\.]([^\s]+)(.*))-->#', $callback, $code);
}
/**