[BUGFIX] Do not overwrite status code of received response 73/59873/3
authorHelmut Hummel <typo3@helhum.io>
Tue, 5 Mar 2019 15:11:56 +0000 (16:11 +0100)
committerBenni Mack <benni@typo3.org>
Sat, 23 Mar 2019 20:30:55 +0000 (21:30 +0100)
The ErrorController must not modify the received response
from the configured handler, to allow the handler to
change it to a suitable value.

Resolves: #87846
Releases: master, 9.5
Change-Id: I91d3ab0a78d383e5a0c9ee47ea21dc8634ddd3c9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/59873
Reviewed-by: Stephan GroƟberndt <stephan.grossberndt@typo3.org>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benjamin Franzke <bfr@qbus.de>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/Error/PageErrorHandler/FluidPageErrorHandler.php
typo3/sysext/frontend/Classes/Controller/ErrorController.php

index 80aa76d..0477bc2 100644 (file)
@@ -73,6 +73,6 @@ class FluidPageErrorHandler implements PageErrorHandlerInterface
             'message' => $message,
             'reasons' => $reasons
         ]);
-        return new HtmlResponse($this->view->render());
+        return new HtmlResponse($this->view->render(), $this->statusCode);
     }
 }
index 55a0244..6160354 100644 (file)
@@ -50,8 +50,7 @@ class ErrorController
         }
         $errorHandler = $this->getErrorHandlerFromSite($request, 500);
         if ($errorHandler instanceof PageErrorHandlerInterface) {
-            $response = $errorHandler->handlePageError($request, $message, $reasons);
-            return $response->withStatus(500, $message);
+            return $errorHandler->handlePageError($request, $message, $reasons);
         }
         return $this->handlePageError(
             $GLOBALS['TYPO3_CONF_VARS']['FE']['pageUnavailable_handling'],
@@ -75,8 +74,7 @@ class ErrorController
     {
         $errorHandler = $this->getErrorHandlerFromSite($request, 404);
         if ($errorHandler instanceof PageErrorHandlerInterface) {
-            $response = $errorHandler->handlePageError($request, $message, $reasons);
-            return $response->withStatus(404, $message);
+            return $errorHandler->handlePageError($request, $message, $reasons);
         }
         if (!$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling']) {
             throw new PageNotFoundException($message, 1518472189);
@@ -102,8 +100,7 @@ class ErrorController
     {
         $errorHandler = $this->getErrorHandlerFromSite($request, 403);
         if ($errorHandler instanceof PageErrorHandlerInterface) {
-            $response = $errorHandler->handlePageError($request, $message, $reasons);
-            return $response->withStatus(403, $message);
+            return $errorHandler->handlePageError($request, $message, $reasons);
         }
         return $this->handlePageError(
             $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'],