Project

General

Profile

Actions

Bug #88059

closed

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 5 years ago. Updated over 5 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']);
Actions

Also available in: Atom PDF