Issue Bug Closed

#102457FrontendConfigurationManager->getTypoScriptSetup() should return empty array if TSFE is not initialized

Markus Gerdes 11/22/23, 15:24 updated 07/09/24, 15:12

Description

As written in the comment of the FrontendConfigurationManager Line 202ff the setup should be an empty array in v12 to be backward compatible.
If

$request->getAttribute('frontend.typoscript');

returns null this would not be a RuntimeException and should be checked separately.

Steps to reproduce:
install schams-net/nagios@4.1.0 extension and call the included middleware.

This results in an Errorpage

Call to a member function getSetupArray() on null

in /var/www/html/vendor/typo3/cms-extbase/Classes/Configuration/FrontendConfigurationManager.php line 202
        /** @var ServerRequestInterface $request */
        $request = $this->request ?? $GLOBALS['TYPO3_REQUEST'];
        $frontendTypoScript = $request->getAttribute('frontend.typoscript');
        try {
            return $frontendTypoScript->getSetupArray();
        } catch (\RuntimeException) {
            // This Extbase bootstrap is executed in a context where TSFE did not calculate TS.
            //
            // This catch mitigates a "You're doing in wrong" case in TYPO3 v12:```

Environment:
TYPO3 v12.4.8
PHP 8.2.1
Linux

Reviews 3