[BUGFIX] Differentiate between null and unset then/else condition branches #1051
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With Fluid 4.1 (in 96099a6) it became possible to
use
f:if
and other condition-based ViewHelpers withoutthen
orelse
, whichwould return the result of the condition as boolean. However, the current
implementation of this feature didn't consider the difference between a ViewHelper
without any
then
orelse
and one withthen
that returnsnull
. These twoexamples would both return the boolean:
With this change, the two examples are treated differently. Instead of checking
the arguments of the ViewHelper (which are already merged with the defined
default values), the ViewHelperNode is used to find out if the argument has
actually been specified. This applies both for uncached rendering and compilation,
which is used for cached templates.
Since the implementation in
AbstractConditionViewHelper
became more and moreconvoluted, both the rendering and the compilation step have been refactored.
Also, more test cases are added, which make sure that the issues of the current
implementation are still addressed with the refactored code.
Resolves: #1049