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('##', $callback, $code); + // (ELSE)?\s?IF; match IF|ELSEIF|ELSE IF; replace ELSE IF with ELSEIF + return preg_replace_callback('##', $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 @@ -62,6 +62,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), '1!false', ), + 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), 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 2 + +|S_OTHER_OTHER_VALUE| 03