Closed Moln closed 6 years ago
It was difficult for us to debug error/exception, when an error/exception occurred by after handle pipeline.
These are situations that may occur.
declare(strict_types=1)
ErrorHandler
There will output an empty response (status 200). Then, we don't know what happened.
Output messages by Whoops.
Response OK (status code 200). And no error/exception outputed.
Remove $whoops->writeToOutput(false) in WhoopsFactory.
$whoops->writeToOutput(false)
WhoopsFactory
https://github.com/zendframework/zend-expressive/blob/491da1e365d54e467026641b5984c0dd181ebe90/src/Container/WhoopsFactory.php#L56
And add disable/enable send on both sides of get handleException result.
handleException
https://github.com/zendframework/zend-expressive/blob/491da1e365d54e467026641b5984c0dd181ebe90/src/Middleware/WhoopsErrorResponseGenerator.php#L82-L84
$sendOutput = $this->whoops->writeToOutput(); $this->whoops->writeToOutput(false); $response ->getBody() ->write($this->whoops->handleException($e)); $this->whoops->writeToOutput($sendOutput); //Restore to write to output.
@Moln would you be willing to create a pull request based on your suggestion?
@weierophinney Yeah, I created.
Code to reproduce the issue
It was difficult for us to debug error/exception, when an error/exception occurred by after handle pipeline.
These are situations that may occur.
declare(strict_types=1)
and exists UTF8+BOM.ErrorHandler
's listeners.There will output an empty response (status 200). Then, we don't know what happened.
Expected results
Output messages by Whoops.
Actual results
Response OK (status code 200). And no error/exception outputed.
Suggestions
Remove
$whoops->writeToOutput(false)
inWhoopsFactory
.https://github.com/zendframework/zend-expressive/blob/491da1e365d54e467026641b5984c0dd181ebe90/src/Container/WhoopsFactory.php#L56
And add disable/enable send on both sides of get
handleException
result.https://github.com/zendframework/zend-expressive/blob/491da1e365d54e467026641b5984c0dd181ebe90/src/Middleware/WhoopsErrorResponseGenerator.php#L82-L84