mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
204d4fb076
commit
f3c0cbc1ab
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user