#111396Handle missing global request in admin panel
Description
Since v14, $GLOBALS[‘TYPO3_REQUEST’] is only set in the frontend
RequestHandler. If a middleware returns a response before that
(e.g. a redirect), the admin panel still renders and accesses the
unset global:
- MainController::render() (page from cache)
- PreviewModule::getPageSettings() / CacheModule::getPageSettings()
Result: “Undefined global variable $TYPO3_REQUEST” or
“Call to a member function getAttribute() on null”.
Real world example: in2code:luxletter link tracking (?luxletterlink=…).
Steps to reproduce:
1. Add a frontend middleware e.g.:
// Configuration/RequestMiddlewares.php
‘frontend’ => [
‘test/early-redirect’ => [
‘target’ => EarlyRedirect::class,
‘after’ => [‘typo3/cms-frontend/prepare-tsfe-rendering’],
],
],
// EarlyRedirect::process()
if (isset($request->getQueryParams()[‘redirect’])) {
return new RedirectResponse(‘/’, 302);
}
return $handler->handle($request);
// ext_localconf.php
$GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘cacheHash’][‘excludedParameters’][] = ‘redirect’;
2. Enable the admin panel:
3. Log in to the backend, open the frontend and open the admin panel.
4. a) Reload the page once (to fill the page cache), then call
/?redirect=1 -> error in MainController
b) Enable “No caching” in the admin panel’s Cache module, then call
/?redirect=1 -> error in PreviewModule / CacheModule
Expected: plain redirect without errors.
Possible Fix: Add a safeguard for calls of $GLOBALS[‘TYPO3_REQUEST’]
Reviews 1
History 01
-
Gerrit Code Review pushed patch set 1 for main to change 97520 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-10T14:55:51+00:00" > 11/10/26, 14:55 </span>