1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 00:07:44 +02:00

[feature/template-engine] Fix negative variable expressions

compile_tag_if had the flawed approach of adding an isset statement for
all variables to the beginning of the if. This fails for negative
expressions, and checking those takes a considerable effort.

The easier solution is to make the variable expression itself
conditional, defaulting to null if it is not set.

Thanks to naderman for the solution.

PHPBB3-9726
This commit is contained in:
Igor Wiedler
2011-04-26 02:09:51 +02:00
committed by Oleg Pudeyev
parent f0b97cfdcf
commit 427a5122d5
4 changed files with 9 additions and 13 deletions

View File

@@ -91,7 +91,7 @@ class phpbb_template_template_test extends phpbb_test_case
array(),
array(),
array(),
"pass\npass\n<!-- DUMMY var -->",
"pass\npass\npass\n<!-- DUMMY var -->",
),
array(
'variable.html',

View File

@@ -16,5 +16,8 @@ fail
<!-- BEGINELSE -->
pass
<!-- END empty -->
<!-- IF not S_EMPTY -->
pass
<!-- ENDIF -->
<!-- DUMMY var -->

View File

@@ -6,6 +6,6 @@
03
<!-- ENDIF -->
<!-- IF (S_VALUE > S_OTHER_VALUE) -->
<!-- IF S_VALUE and S_OTHER_VALUE and (S_VALUE > S_OTHER_VALUE) -->
04
<!-- ENDIF -->