59873[BUGFIX] Do not overwrite status code of received response
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Benjamin Franzke +1
- Stephan Großberndt +1
- Markus Klein +1
-
Verified V +2 Done
- Benni Mack +2
- Benjamin Franzke +1
- TYPO3com +1 CI
Issues 1
Files 2
Review log 1315
-
Helmut Hummel uploaded patch set 1 03/05/19, 15:14
-
Markus Klein commented on patch set 1 CR -1 03/05/19, 15:24
At least we should add a check that no 200 is returned by the handler. Eg. \TYPO3\CMS\Core\Error\PageErrorHandler\FluidPageErrorHandler does not handle the passed status code -
TYPO3com voted on patch set 1 V -1 03/05/19, 15:28 Completed build in 14m 31s on Tue, 5 Mar, 04:28 PM Test Summary: 99 of 47205 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32536
-
Helmut Hummel uploaded patch set 2 03/08/19, 22:28
-
Helmut Hummel commented on patch set 2 03/08/19, 22:33
> At least we should add a check that no 200 is returned by the handler I indeed thought about that. Strictly the proposed change is breaking. However checking for 200 means, that custom error handlers would not be allowed to decide to use this status. While I don't have a concrete use case in mind for an error handler to return 200 (all good), there is no technical reason this might be invalid and needs override. I had no other idea how to detect whether the 200 code is accidental (like in FluidPageErrorHandler) or intentional -
Stephan Großberndt commented on patch set 2 CR +1 03/08/19, 22:46
I would not add a limitation on HTTP status here. -
TYPO3com voted on patch set 2 V +1 03/08/19, 22:46 Completed build in 18m 11s on Fri, 8 Mar, 11:46 PM Test Summary: 47197 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32621
-
Benjamin Franzke commented on patch set 2 CR +1 03/09/19, 00:28
ErrorController.php:53UnresolvedI prefer being a bit breaking here, as it is quite odd to overwrite the status code which the error handler provides. If we'd really want to be non breaking here, but still want to support a 200 response code, we could use a header to specify that 200 is actually desired and should not be overwritten. Could look like the following (though I don't really like that code): $response = $errorHandler->handlePageError($request, $message, $reasons); if ( $response->getStatusCode() === 200 && !$response->hasHeader('X-TYPO3-Error-Handler-Send-200') ) { return $response ->withoutHeader('X-TYPO3-Error-Handler-Send-200') ->withStatus(500, $message); } return $response; -
Tymoteusz Motylewski commented on patch set 2 03/09/19, 11:53
ErrorController.php:53to understand impact better, can you explain what scenarios will be broken? -
Benni Mack commented on patch set 2 03/09/19, 12:58
ErrorController.php:53ReplyAh, I see your point. The ErrorHandler could still send 200 if he/she wishes to do so, but only if the additional header is sent as well. -
Benjamin Franzke commented on patch set 2 V +1 03/15/19, 14:17
ErrorController.php:53Reply UnresolvedYup, so the question is whether the want to add that ugly hack (that I gave as example) as API to stay 100% compatible, or rather do the right thing (as suggested by Helmut) and be slighty breaking here. To summarize: In my helper-header-example nothing would break, it rather adds the possibility to sent every header – while the previous behaviour – that the "default" response code is changed to 500 – is preserved. In Helmuts suggestions these handlers that didn't add the proper response code would be considered are considered buggy and therefore need to be adapted. I mean, these handlers even get the desired response code injected, so it's clear that they should create a Response with that response code. I really see the previous Fluid handler behaviour as BUG in that handler, and therefore vote for merging this patch as is. Markus, are you fine with that? You gave the -1 on the initial patch. -
Markus Klein commented on patch set 2 CR +1 03/15/19, 19:54
I'm totally fine with that, my -1 was only because of the missing adaption of the FluidPageErrorHandler, which is there now. -
Benni Mack voted on patch set 2 V +2 CR +2 03/23/19, 20:30
-
Benni Mack merged patch set 3 03/23/19, 20:30
-
Helmut Hummel commented on patch set 3 03/24/19, 09:44
Thanks!