Skip to content

Commit

Permalink
[BUGFIX] Guard ViewHelper argument with null-coalesce operator
Browse files Browse the repository at this point in the history
This changes guards the `extension` argument of the ViewHelper
with the null-coalesce operator and a string-cast to avoid a
TypeError with TYPO3 v12 which expectes a string for the
`ExtensionManagementUtility::isLoaded()`method.
  • Loading branch information
sbuerk authored and calien666 committed Jul 21, 2023
1 parent 87c071b commit cbb5fb6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Be/ExtensionActiveViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function initializeArguments(): void

public static function verdict(array $arguments, RenderingContextInterface $renderingContext): bool
{
if (ExtensionManagementUtility::isLoaded($arguments['extension'])) {
if (ExtensionManagementUtility::isLoaded((string)($arguments['extension'] ?? ''))) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function renderDataProvider(): \Generator
[],
'elseArgument',
];

yield 'extension provided as undefined fluid variable placeholder, await else' => [
'<deepl:be.extensionActive extension="{someUndefinedVariable}" then="thenArgument" else="elseArgument" />',
[],
Expand Down

0 comments on commit cbb5fb6

Please sign in to comment.