Preventing possible errors caused by sending headers when testing on cli

This commit is contained in:
Jose Lorenzo Rodriguez 2011-04-22 09:03:55 -04:30
parent d8933fb773
commit 8ff0330789

View file

@ -363,10 +363,12 @@ class CakeResponse {
* @return void
*/
protected function _sendHeader($name, $value = null) {
if (is_null($value)) {
header($name);
} else {
header("{$name}: {$value}");
if (!headers_sent()) {
if (is_null($value)) {
header($name);
} else {
header("{$name}: {$value}");
}
}
}