mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
throw an Exception when header is already been sent
This commit is contained in:
parent
3c1d3ee461
commit
792c251890
1 changed files with 5 additions and 3 deletions
|
@ -518,14 +518,16 @@ class CakeResponse {
|
|||
* @param string $value the header value
|
||||
* @return void
|
||||
*/
|
||||
protected function _sendHeader($name, $value = null) {
|
||||
if (!headers_sent()) {
|
||||
protected function _sendHeader($name, $value = null) {
|
||||
if (!headers_sent($filename, $linenum)) {
|
||||
if ($value === null) {
|
||||
header($name);
|
||||
} else {
|
||||
header("{$name}: {$value}");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception("Headers already sent in $filename on line $linenum\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue