Bug #88059
closedUncaught TYPO3 Exception: htmlspecialchars() expects parameter 1 to be string, null given | TypeError thrown in file /srv/[pathto]/RequestHandler.php
100%
Description
Including an external css file with @import via includeCSS or includeCSSLibs results in an uncaught TYPO3 exception if the optional property media is not set. (https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Page/Index.html#includecss-array)
Example:
page.includeCSS { css = https://some.external/css/file.css css.external = 1 css.import = 1 css.media = some value #not optional atm }
Conditional usage of $cssFileConfig['media'] can solve this issue.
I suggest to change lines 490 and 532 of RequestHandler.php from
$pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($cssFileConfig['media']) . ';', empty($cssFileConfig['disableCompression']), (bool)$cssFileConfig['forceOnTop']);
to
$pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($cssFileConfig['media'] ? $cssFileConfig['media']:'') . ';', empty($cssFileConfig['disableCompression']), (bool)$cssFileConfig['forceOnTop']);
Updated by Gerrit Code Review over 5 years 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/+/60420
Updated by Gerrit Code Review over 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60457
Updated by Benni Mack over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f1171848560872714af3639c1f2547121f1fb8af.