Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: pgaultier/yii
base: beb8e74035
...
head fork: pgaultier/yii
compare: 7db77f3fd0
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 7 additions and 9 deletions.
  1. +1 −0  CHANGELOG
  2. +6 −9 framework/base/CErrorHandler.php
View
1  CHANGELOG
@@ -21,6 +21,7 @@ Version 1.1.11 work in progress
- Enh: Added getIsFlashRequest(), proper handling of Flash/Flex request when using CWebLogRoute with FireBug (resurtm)
- Enh: Added CBreadcrumbs::$activeLinkTemplate and CBreadcrumbs::$inactiveLinkTemplate properties which allows to change each item's template (resurtm)
- Enh: Added full-featured behaviors and events CConsoleCommand::onBeforeAction & CConsoleCommand::onAfterAction (Yiivgeny)
+- Enh: Added CErrorHandler::getHttpHeader() to send correct HTTP error codes (pgaultier)
Version 1.1.10 February 12, 2012
--------------------------------
View
15 framework/base/CErrorHandler.php
@@ -177,7 +177,7 @@ protected function handleException($exception)
);
if(!headers_sent())
- header("HTTP/1.0 {$data['code']} ".self::getHttpHeader($data['code'], get_class($exception)));
+ header("HTTP/1.0 {$data['code']} ".$this->getHttpHeader($data['code'], get_class($exception)));
if($exception instanceof CHttpException || !YII_DEBUG)
$this->render('error',$data);
@@ -259,10 +259,7 @@ protected function handleError($event)
'traces'=>$trace,
);
if(!headers_sent())
- if(!YII_DEBUG)
- header("HTTP/1.0 500 Internal Server Error");
- else
- header("HTTP/1.0 500 PHP Error");
+ header("HTTP/1.0 500 Internal Server Error");
if($this->isAjaxRequest())
$app->displayError($event->code,$event->message,$event->file,$event->line);
else if(YII_DEBUG)
@@ -488,12 +485,12 @@ protected function renderSourceCode($file,$errorLine,$maxLines)
return '<div class="code"><pre>'.$output.'</pre></div>';
}
/**
- * Return correct message for each know http error code
+ * Return correct message for each known http error code
* @param integer $httpCode error code to map
* @param string $replacement error string if code is unknown
- * @return string the textual error code is returned or the replacement string if it does not exist
+ * @return string the textual representation of the given error code or the replacement string if the error code is unknown
*/
- protected static function getHttpHeader($httpCode, $replacement='')
+ protected function getHttpHeader($httpCode, $replacement='')
{
$httpCodes = array(
100 => 'Continue',
@@ -554,7 +551,7 @@ protected static function getHttpHeader($httpCode, $replacement='')
);
if(isset($httpCodes[$httpCode]))
return $httpCodes[$httpCode];
- else
+ else
return $replacement;
}
}

No commit comments for this range

Something went wrong with that request. Please try again.