Issue Bug Closed

#100363Using a PropagateResponseException (for 404) in controller action displays Fluid error instead of 404 page since v12

Chris Müller 03/31/23, 11:17 updated 07/07/24, 17:16

Description

I am using this code in an Extbase show controller action to propagate the configured 404 page when a particular condition in the given model is not matched:

$response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
    $this->request,
    'The requested product does not exist',
    [
        'code' => PageAccessFailureReasons::PAGE_NOT_FOUND,
    ],
);
throw new PropagateResponseException($response, 1615293813);

This works like expected in TYPO3 v11.5: The 404 page configured in the site configuration is displayed.

However, with v12.3 the following error is displayed instead of the 404 page:

Tried resolving a template file for controller action "Show->show" in format ".html", but none of the paths contained the expected template file (Show/Show.html). The following paths were checked: /var/www/html/vendor/myvendor/site/Resources/Private/Templates/Page/

with status code 500.

It looks like the subrequest(?) wants to use the Show template of the action for some reason (and looks for it in the folder for the page templates).

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.