Actions
Bug #90539
closedTypeError in new AssetCollection related ViewHelpers
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.
Actions