TYPO3 Exception 1666513645
Note
Below, the TYPO3 community may have provided additional information or solutions for this exception. However, these may or may not apply to your particular case. If you can provide more information, you should come back here and add your experience and solution steps to this issue once you have resolved it.
General TYPO3 troubleshooting tips can be found in the Troubleshooting section in the menu. You can also ask questions and receive support in the TYPO3 Questions category on talk.typo3.org.
To add your experience, click "Edit on GitHub" above and follow the "Edit on GitHub" workflow. Also check out our tip on Coding Style and reST.
TYPO3 13.4 - 30th December 2024
Installation Overview
It uses the extension tslib_fetce 0.9.2 which uses the FrontendTce class Middleware.
The Issue
RuntimeException
Setup array has not been initialized. This happens in cached Frontend scope where full TypoScript is not needed by the system.
1st Solution
Call the method hasSetup before getSetupArray.
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$frontendTypoScript = $request->getAttribute('frontend.typoscript');
if ($frontendTypoScript->hasSetup()) {
$typoScriptSetupArray = $frontendTypoScript->getSetupArray();
// ...
}
}
2nd Solution
Initialize the setSetupArray before getSetupArray checks the setup array
/**
* Renders the admin panel - Called in PSR-15 Middleware
*
* @see \TYPO3\CMS\Adminpanel\Middleware\AdminPanelRenderer
*/
public function render(ServerRequestInterface $request): string
{
$resources = ResourceUtility::getResources(['nonce' => $this->requestId->nonce]);
$backupRequest = null;
$frontendTypoScript = $request->getAttribute('frontend.typoscript');
if (!$frontendTypoScript->hasSetup()) {
// @todo: This is a hack: The admin panel is the only extension that starts
// a Fluid view in 'fully cached' scenarios. f:translate() now triggers
// the extbase configuration manager in FE, which fetches TS setup from
// the Request attribute, which is *usally* always available, *except*
// in fully cached scenarios.
// See https://review.typo3.org/c/Packages/TYPO3.CMS/+/80732
// We still want extbase to crash if it tries to fetch TS setup when it
// is not set, so we work around this in the admin panel here.
// This should later be resolved by avoiding the dependency to extbase
// LocalizationUtility again, when core localization services can do
// similar things in FE as well.
$frontendTypoScript = clone $frontendTypoScript;
$frontendTypoScript->setSetupArray([]);
$request = $request->withAttribute('frontend.typoscript', $frontendTypoScript);
$GLOBALS['TYPO3_REQUEST'] = $request;
}
}
3rd Solution
Configure the middleware in a way that the initialization of the setup array is executed before the middleware.
use MyDomain\MyExtension\Middleware\XajaxHandler;
return [
'frontend' => [
'mydomain/myextension/preprocessing' => [
'target' => XajaxHandler::class,
'description' => 'Calls to my extension will be processed and no page will be generated.',
'after' => [
'typo3/cms-frontend/prepare-tsfe-rendering'
],
'before' => [
'typo3/cms-frontend/content-length-headers',
],
],
],
];