Skip to content

[BUGFIX] Use null instead of empty string as default for condition VHs#1050

Merged
s2b merged 1 commit intomainfrom
bugfix/ifViewhelperNull
Apr 17, 2025
Merged

[BUGFIX] Use null instead of empty string as default for condition VHs#1050
s2b merged 1 commit intomainfrom
bugfix/ifViewhelperNull

Conversation

@s2b
Copy link
Copy Markdown
Contributor

@s2b s2b commented Apr 16, 2025

This partially reverts 3084952: Now all condition-based ViewHelpers use
null as default return value instead of '' because this is more
consistent when then or else returns null, for example if a
non-existent variable is used there:

{f:if(condition: true, then: nonExistingVariable)}

This should return null, but now returns ''. Note that this change
is only a pre-patch, a follow-up will actually achieve the desired
behavior from that example.

For all other use-cases, this change shouldn't be a problem because
null will be converted to '' anyways.

This partially reverts 3084952: Now all condition-based ViewHelpers use
`null` as default return value instead of `''` because this is more consistent
when `then` or `else` returns `null`, for example if a non-existent variable
is used there:

```
{f:if(condition: true, then: nonExistingVariable)}
```

This should return `null`, but now returns `''`. Note that this change is only
a pre-patch, a follow-up will actually achieve the desired behavior from that
example.

For all other use-cases, this change shouldn't be a problem because `null`
will be converted to `''` anyways.
@sascha-egerer
Copy link
Copy Markdown
Contributor

👍

@s2b s2b merged commit 4f268f9 into main Apr 17, 2025
8 checks passed
@s2b s2b deleted the bugfix/ifViewhelperNull branch April 17, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants