Bug #88059

Uncaught TYPO3 Exception: htmlspecialchars() expects parameter 1 to be string, null given | TypeError thrown in file /srv/[pathto]/RequestHandler.php

Added by Jan Loderhose over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2019-04-03
Due date:
% Done:

100%

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

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']);
#1

Updated by Gerrit Code Review over 3 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

#2

Updated by Gerrit Code Review over 3 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

#3

Updated by Benni Mack over 3 years ago

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

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF