[BUGFIX] Do not cache content with different status code than 200 81/58581/2
authorMarkus Klein <markus.klein@typo3.org>
Fri, 5 Oct 2018 08:43:05 +0000 (10:43 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 10 Oct 2018 18:41:50 +0000 (20:41 +0200)
Resolves: #83755
Releases: master, 8.7, 7.6
Change-Id: I6e13133f221137c63283ec1575fc405a38668b1a
Reviewed-on: https://review.typo3.org/58581
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Classes/Http/RequestHandler.php

index 89e0b13..a147bf7 100644 (file)
@@ -285,6 +285,11 @@ class RequestHandler implements RequestHandlerInterface
             $GLOBALS['error']->debugOutput();
         }
         GeneralUtility::devLog('END of FRONTEND session', 'cms', 0, ['_FLUSH' => true]);
+        // if any code set a response code that is not 200 clear the cache's content
+        // if we fail to do so we would deliver cache content with a wrong header, which causes big mess.
+        if (http_response_code() !== 200) {
+            $this->controller->clearPageCacheContent();
+        }
         return $response;
     }