Issue Bug Resolved

#110774PageContentErrorHandler subrequest reuse Extbase request

Rémy DANIEL 09/24/26, 13:22 updated 10/10/26, 06:30

Description

In an Extbase action plugin, $this->request passed to pageNotFoundAction is an Extbase request, proxyfying the main request.

        if (!$news instanceof News) {
            $response = GeneralUtility::makeInstance(ErrorController::class)
                ->pageNotFoundAction(
                    $this->request,
                    LocalizationUtility::translate('error.404.message.default', 'Site'),
                    [
                        LocalizationUtility::translate('error.404.reasons.news.unavailabled', 'Site'),
                    ]
                );
            throw new PropagateResponseException($response, 1724319487);
        }

In PageContentErrorHandler::handlePageError , the request’s uri+query+method are enforced.
But no reset of the other attributes is performed, and the Extbase request’s attribute is therefore retained in the application’s sub-request.

$subRequest = $request
    ->withQueryParams([])->withUri(new Uri($resolvedUrl))
    ->withMethod('GET');

When the 404 page template is generated in `FluidTemplateContentObject`, the view contains the previous Extbase request in its `baseRenderingContext` property. The view is therefore generated with this context and the template is the plugin’s template, not the page template.

In our setup, the news detail template contains something that throw an Exception if there is no news (we can obsiously fix that, but that’s not the point).
The 404 page generation crash with an error, that gets cached.

Adding ->withoutAttribute('extbase') to the subRequest fixes the issue.

A workaround is to pass $GLOBALS['TYPO3_REQUEST'] to pageNotFoundAction , like before.

—

Since TYPO3 12, still an issue in v14.

Reviews 2

History 27

  1. Wolfgang Klinger commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-10T06:30:11+00:00" > 10/10/26, 06:30 </span>

    Applied in changeset commit:773bb17b2f2e335d7539f115e64db7d464a71766.