Check headers sent before sending PHP response
If the response contents has been sent before an error occurs, PHP triggers the warning "Cannot modify header information - headers already sent" This change ensure that the error message is echoed, while it's impossible to change the HTTP status code and headers.
This commit is contained in:
parent
26d4db3e8b
commit
97591c1b30
@ -91,9 +91,11 @@ class ExceptionHandler
|
||||
$exception = FlattenException::create($exception);
|
||||
}
|
||||
|
||||
header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
|
||||
foreach ($exception->getHeaders() as $name => $value) {
|
||||
header($name.': '.$value, false);
|
||||
if (!headers_sent()) {
|
||||
header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
|
||||
foreach ($exception->getHeaders() as $name => $value) {
|
||||
header($name.': '.$value, false);
|
||||
}
|
||||
}
|
||||
|
||||
echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
|
||||
|
Reference in New Issue
Block a user