aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-09-26 10:59:14 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-09-26 10:59:14 +0200
commite8303bc3199081d1f9f0679d3b98298ccdc49deb (patch)
tree4c30b0332e46434356567f3cbad10d831295b620
parent779688b56b4fc22f975cb1b2a39b55d4b9afc231 (diff)
parent9152455d706adafa4e89bfdf6acc4b7c101f6f0a (diff)
downloadforums-e8303bc3199081d1f9f0679d3b98298ccdc49deb.tar
forums-e8303bc3199081d1f9f0679d3b98298ccdc49deb.tar.gz
forums-e8303bc3199081d1f9f0679d3b98298ccdc49deb.tar.bz2
forums-e8303bc3199081d1f9f0679d3b98298ccdc49deb.tar.xz
forums-e8303bc3199081d1f9f0679d3b98298ccdc49deb.zip
Merge remote-tracking branch 'EXreaction/ticket/11816-2' into develop
* EXreaction/ticket/11816-2: [ticket/11816] Fix multiple parenthesis as well before $VARs in templates
-rw-r--r--phpBB/phpbb/template/twig/lexer.php8
-rw-r--r--tests/template/template_test.php2
-rw-r--r--tests/template/templates/define.html3
3 files changed, 8 insertions, 5 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index a73d276e62..d832fbf84e 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -231,18 +231,18 @@ class lexer extends \Twig_Lexer
{
$inner = $matches[2];
// Replace $TEST with definition.TEST
- $inner = preg_replace('#(\s\(?!?)\$([a-zA-Z_0-9]+)#', '$1definition.$2', $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\.])#', '$1loops.$2|length$3', $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$2|length$3', $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}-->";
};
- return preg_replace_callback('#<!-- (ELSE)?IF((.*?) \(?!?[\$|\.]([^\s]+)(.*?))-->#', $callback, $code);
+ return preg_replace_callback('#<!-- (ELSE)?IF((.*?) \(*!?[\$|\.]([^\s]+)(.*?))-->#', $callback, $code);
}
/**
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 2cca20f4c2..39eb08ab79 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -158,7 +158,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
array(),
- "xyz\nabc\n\$VALUE == 'abc'\n(\$VALUE == 'abc')\n!\$DOESNT_EXIST\n(!\$DOESNT_EXIST)\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?[]|foobar|",
+ "xyz\nabc\n\$VALUE == 'abc'\n(\$VALUE == 'abc')\n((\$VALUE == 'abc'))\n!\$DOESNT_EXIST\n(!\$DOESNT_EXIST)\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?[]|foobar|",
),
array(
'define_advanced.html',
diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html
index bc20c02ed1..e7ce7f7def 100644
--- a/tests/template/templates/define.html
+++ b/tests/template/templates/define.html
@@ -10,6 +10,9 @@ $VALUE == 'abc'
<!-- IF ($VALUE == 'abc') -->
($VALUE == 'abc')
<!-- ENDIF -->
+<!-- IF (($VALUE == 'abc')) -->
+(($VALUE == 'abc'))
+<!-- ENDIF -->
<!-- IF !$DOESNT_EXIST -->
!$DOESNT_EXIST
<!-- ENDIF -->