Convert header_sent exception into a notice error.

Throwing an exception here, causes an infinite loop when handling fatal
errors, as the shutdown function sends headers automatically.

Refs #5595
This commit is contained in:
mark_story 2015-01-08 21:47:13 -05:00
parent 2ee5c3d73d
commit a7aaa93131

View file

@ -520,9 +520,11 @@ class CakeResponse {
*/
protected function _sendHeader($name, $value = null) {
if (headers_sent($filename, $linenum)) {
throw new CakeException(
__d('cake_dev', 'Headers already sent in %s on line %s', $filename, $linenum)
trigger_error(
__d('cake_dev', 'Headers already sent in %s on line %s', $filename, $linenum),
E_USER_NOTICE
);
return;
}
if ($value === null) {
header($name);