Permalink
Browse files

BUGFIX: Better error message when 401 response is corrupted.

  • Loading branch information...
1 parent f8206d1 commit 82988d421bb28ef0e04f0fea8c6c6fd60c54c58a @sminnee sminnee committed with chillu Mar 11, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 control/HTTPResponse.php
View
@@ -220,11 +220,17 @@ public function output() {
<meta http-equiv=\"refresh\" content=\"1; url=$url\" />
<script type=\"text/javascript\">setTimeout('window.location.href = \"$url\"', 50);</script>";
} else {
- if(!headers_sent()) {
+ $line = $file = null;
+ if(!headers_sent($file, $line)) {
header($_SERVER['SERVER_PROTOCOL'] . " $this->statusCode " . $this->getStatusDescription());
foreach($this->headers as $header => $value) {
header("$header: $value", true, $this->statusCode);
}
+ } else {
+ // It's critical that these status codes are sent; we need to report a failure if not.
+ if($this->statusCode >= 300) {
+ user_error("Couldn't set response type to $this->statusCode because of output on line $line of $file", E_USER_WARNING);
+ }
}
// Only show error pages or generic "friendly" errors if the status code signifies

0 comments on commit 82988d4

Please sign in to comment.