Project

General

Profile

Actions

Bug #84865

closed

Redirect functionality from pageNotFoundAndExit cant set the header status code

Added by Tommy Bley about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2018-04-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

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

Actions

Also available in: Atom PDF