Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 2 files changed
  • 0 comments
  • 1 contributor

Showing 2 changed files with 7 additions and 9 deletions. Show diff stats Hide diff stats

  1. +1 0  CHANGELOG
  2. +6 9 framework/base/CErrorHandler.php
1  CHANGELOG
@@ -21,6 +21,7 @@ Version 1.1.11 work in progress
21 21 - Enh: Added getIsFlashRequest(), proper handling of Flash/Flex request when using CWebLogRoute with FireBug (resurtm)
22 22 - Enh: Added CBreadcrumbs::$activeLinkTemplate and CBreadcrumbs::$inactiveLinkTemplate properties which allows to change each item's template (resurtm)
23 23 - Enh: Added full-featured behaviors and events CConsoleCommand::onBeforeAction & CConsoleCommand::onAfterAction (Yiivgeny)
  24 +- Enh: Added CErrorHandler::getHttpHeader() to send correct HTTP error codes (pgaultier)
24 25
25 26 Version 1.1.10 February 12, 2012
26 27 --------------------------------
15 framework/base/CErrorHandler.php
@@ -177,7 +177,7 @@ protected function handleException($exception)
177 177 );
178 178
179 179 if(!headers_sent())
180   - header("HTTP/1.0 {$data['code']} ".self::getHttpHeader($data['code'], get_class($exception)));
  180 + header("HTTP/1.0 {$data['code']} ".$this->getHttpHeader($data['code'], get_class($exception)));
181 181
182 182 if($exception instanceof CHttpException || !YII_DEBUG)
183 183 $this->render('error',$data);
@@ -259,10 +259,7 @@ protected function handleError($event)
259 259 'traces'=>$trace,
260 260 );
261 261 if(!headers_sent())
262   - if(!YII_DEBUG)
263   - header("HTTP/1.0 500 Internal Server Error");
264   - else
265   - header("HTTP/1.0 500 PHP Error");
  262 + header("HTTP/1.0 500 Internal Server Error");
266 263 if($this->isAjaxRequest())
267 264 $app->displayError($event->code,$event->message,$event->file,$event->line);
268 265 else if(YII_DEBUG)
@@ -488,12 +485,12 @@ protected function renderSourceCode($file,$errorLine,$maxLines)
488 485 return '<div class="code"><pre>'.$output.'</pre></div>';
489 486 }
490 487 /**
491   - * Return correct message for each know http error code
  488 + * Return correct message for each known http error code
492 489 * @param integer $httpCode error code to map
493 490 * @param string $replacement error string if code is unknown
494   - * @return string the textual error code is returned or the replacement string if it does not exist
  491 + * @return string the textual representation of the given error code or the replacement string if the error code is unknown
495 492 */
496   - protected static function getHttpHeader($httpCode, $replacement='')
  493 + protected function getHttpHeader($httpCode, $replacement='')
497 494 {
498 495 $httpCodes = array(
499 496 100 => 'Continue',
@@ -554,7 +551,7 @@ protected static function getHttpHeader($httpCode, $replacement='')
554 551 );
555 552 if(isset($httpCodes[$httpCode]))
556 553 return $httpCodes[$httpCode];
557   - else
  554 + else
558 555 return $replacement;
559 556 }
560 557 }

No commit comments for this range

Something went wrong with that request. Please try again.