diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php index 46a5c34c5d32e7c1ecec5e6e0b9be2c7550c3a34..856c09dcacb5575e593276a304f41729b1dc4b64 100644 --- a/typo3/sysext/core/Classes/Page/PageRenderer.php +++ b/typo3/sysext/core/Classes/Page/PageRenderer.php @@ -23,6 +23,8 @@ use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Localization\Locales; use TYPO3\CMS\Core\Localization\LocalizationFactory; use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry; +use TYPO3\CMS\Core\Package\Package; +use TYPO3\CMS\Core\Package\PackageInterface; use TYPO3\CMS\Core\Package\PackageManager; use TYPO3\CMS\Core\Resource\RelativeCssPathFixer; use TYPO3\CMS\Core\Resource\ResourceCompressor; @@ -104,7 +106,7 @@ class PageRenderer implements SingletonInterface // Arrays containing associative array for the included files /** - * @var array + * @var array<string, array> */ protected $jsFiles = []; @@ -124,12 +126,12 @@ class PageRenderer implements SingletonInterface protected $jsFooterLibs = []; /** - * @var array + * @var array<string, array> */ protected $cssFiles = []; /** - * @var array + * @var array<string, array> */ protected $cssLibs = []; @@ -225,7 +227,7 @@ class PageRenderer implements SingletonInterface // Static inline code blocks /** - * @var array + * @var array<string, array> */ protected $jsInline = []; @@ -235,7 +237,7 @@ class PageRenderer implements SingletonInterface protected $jsFooterInline = []; /** - * @var array + * @var array<string, array> */ protected $cssInline = []; @@ -1348,7 +1350,7 @@ class PageRenderer implements SingletonInterface * resource folders plus some additional generic configuration. * * @param bool $isDevelopment - * @param array $packages + * @param array<string, PackageInterface> $packages * @return array The RequireJS configuration */ protected function computeRequireJsConfig($isDevelopment, array $packages) @@ -1931,7 +1933,7 @@ class PageRenderer implements SingletonInterface { $templateFile = GeneralUtility::getFileAbsFileName($this->templateFile); if (is_file($templateFile)) { - $template = file_get_contents($templateFile); + $template = (string)file_get_contents($templateFile); if ($this->removeLineBreaksFromTemplate) { $template = strtr($template, [LF => '', CR => '']); } @@ -2545,7 +2547,7 @@ class PageRenderer implements SingletonInterface if (strpos($file, 'EXT:') === 0) { $file = GeneralUtility::getFileAbsFileName($file); // as the path is now absolute, make it "relative" to the current script to stay compatible - $file = PathUtility::getRelativePathTo($file); + $file = PathUtility::getRelativePathTo($file) ?? ''; $file = rtrim($file, '/'); } else { $file = GeneralUtility::resolveBackPath($file); @@ -2695,6 +2697,9 @@ class PageRenderer implements SingletonInterface protected function createInlineCssTagFromFile(string $file, array $properties): string { $cssInline = file_get_contents($file); + if ($cssInline === false) { + return ''; + } $cssInlineFix = $this->getPathFixer()->fixRelativeUrlPaths($cssInline, '/' . PathUtility::dirname($file) . '/'); return '<style type="text/css"' . ' media="' . htmlspecialchars($properties['media']) . '"'