Bug #84865
closedRedirect functionality from pageNotFoundAndExit cant set the header status code
0%
Description
Hello,
I have found the following bug in the currently LTS version 8.7.12. My my case i would like to send my user to a fallback page when going to a old page, or a page that not exists.
I have used the following Code
...
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = 'REDIRECT:/refererpage-example.html';
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_statheader'] = 'HTTP/1.0 404 Not Found';
$GLOBALS['TSFE']->pageNotFoundAndExit();
...
i would like to send the header statuscode 404 (Page not found). But I only got the Header Code 303
after debugging i have found the following:
https://api.typo3.org/typo3cms/current/html/_typo_script_frontend_controller_8php_source.html#l01970
TypoScriptFrontendController->pageNotFoundAndExit();
> Line:1973 -> $this>pageNotFoundHandler();
-> Line:2076 -> [condition::TRUE] GeneralUtility::isFirstPartOfStr($code, 'REDIRECT:')
-> Line:2077 -> HttpUtility::redirect(substr($code, 9));
and this is the misstake.
In Line 2077 will used the HttpUtility redirect method and the status code is not given to the method (second argument)
this is needed to solve the bug
Line:2077 -> HttpUtility::redirect(substr($code, 9), $header);
Thx a lot