aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/template/twig/lexer.php3
-rw-r--r--tests/template/template_test.php7
-rw-r--r--tests/template/templates/if.html2
3 files changed, 11 insertions, 1 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 4f88147542..1a640e559e 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -236,7 +236,8 @@ 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);
+ // (ELSE)?\s?IF; match IF|ELSEIF|ELSE IF; replace ELSE IF with ELSEIF
+ return preg_replace_callback('#<!-- (ELSE)?\s?IF(.+?)-->#', $callback, $code);
}
/**
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index dd9ba21c26..2a40107d90 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -64,6 +64,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
),
array(
'if.html',
+ array('S_OTHER_OTHER_VALUE' => true),
+ array(),
+ array(),
+ '|S_OTHER_OTHER_VALUE|!false',
+ ),
+ array(
+ 'if.html',
array('S_VALUE' => false, 'S_OTHER_VALUE' => true),
array(),
array(),
diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html
index c010aff7fa..f6ab6e575a 100644
--- a/tests/template/templates/if.html
+++ b/tests/template/templates/if.html
@@ -2,6 +2,8 @@
1
<!-- ELSEIF S_OTHER_VALUE -->
2
+<!-- ELSE IF S_OTHER_OTHER_VALUE -->
+|S_OTHER_OTHER_VALUE|
<!-- ELSE -->
03
<!-- ENDIF -->