BUGFIX Setting HTTP status in current controller for Debug::friendlyError() to avoid it being overwritten in HTTPResponse->output() later in the execution chain

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92535 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:31:30 +00:00
parent 204d4fb076
commit f3c0cbc1ab

View File

@ -317,7 +317,15 @@ class Debug {
if(!$friendlyErrorMessage) $friendlyErrorMessage = self::$friendly_error_header;
if(!$friendlyErrorDetail) $friendlyErrorDetail = self::$friendly_error_detail;
if(!headers_sent()) header($_SERVER['SERVER_PROTOCOL'] . " $statusCode $friendlyErrorMessage");
if(!headers_sent()) {
$currController = Controller::curr();
if($currController) {
$response = $currController->getResponse();
$response->setStatusCode($statusCode, $friendlyErrorMessage);
} else {
header($_SERVER['SERVER_PROTOCOL'] . " $statusCode $friendlyErrorMessage");
}
}
if(Director::is_ajax()) {
echo $friendlyErrorMessage;