Skip to content

Commit c821755

Browse files
committed
[BUGFIX] Allow NULL for optional arguments with default (#1222)
If a component or ViewHelper argument is not required and is not supplied in the ViewHelper call, Fluid takes care of filling in the default value. But this also happens if the argument is supplied and is set to `NULL`. This usually happens if an undefined variable is provided to the ViewHelper. For ViewHelpers this is done by the `ViewHelperInvoker`, for components in `AbstractTemplateView::processAndValidateTemplateVariables()`. The current implementation of `StrictArgumentProcessor` prevents the fallback from happening if the argument is supplied, but with `NULL` as value. This patch adjusts the `StrictArgumentProcessor` to also pass `NULL` values through. Related: #1221
1 parent e47a754 commit c821755

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Core/ViewHelper/StrictArgumentProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function isValid(mixed $value, ArgumentDefinition $definition): bool
5151
}
5252

5353
// Always allow default value if argument is not required
54-
if (!$definition->isRequired() && $value === $definition->getDefaultValue()) {
54+
if (!$definition->isRequired() && ($value === null || $value === $definition->getDefaultValue())) {
5555
return true;
5656
}
5757

0 commit comments

Comments
 (0)