Bug #90539

TypeError in new AssetCollection related ViewHelpers

Added by Oliver Bartsch 11 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Category:
Fluid
Target version:
-
Start date:
2020-02-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The ViewHelpers TYPO3\CMS\Fluid\ViewHelpers\Asset\CssViewHelper and TYPO3\CMS\Fluid\ViewHelpers\Asset\ScriptViewHelper are throwing a TypeError if they have an empty body and not provide a source file (href / src).

Argument 2 passed to TYPO3\CMS\Core\Page\AssetCollector::addInlineStyleSheet() must be of the type string, null given, called in /var/www/html/typo3/sysext/fluid/Classes/ViewHelpers/Asset/CssViewHelper.php on line 97

respectively

Argument 2 passed to TYPO3\CMS\Core\Page\AssetCollector::addInlineJavaScript() must be of the type string, null given, called in /var/www/html/typo3/sysext/fluid/Classes/ViewHelpers/Asset/ScriptViewHelper.php on line 93

Surely this is a mistake made in the template but this leads to an unnecessary error which could easily be prevented.

Either by using null coalescing to set an empty string in case of null or better just add a condition to check for $this->renderChildren() and not call the addInline*() function at all in this case.

#1

Updated by Gerrit Code Review 11 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63437

#2

Updated by Gerrit Code Review 11 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63437

#3

Updated by Gerrit Code Review 11 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63437

#4

Updated by Oliver Bartsch 11 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#5

Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF