summaryrefslogtreecommitdiff
path: root/includes/exception/MWException.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/exception/MWException.php')
-rw-r--r--includes/exception/MWException.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/includes/exception/MWException.php b/includes/exception/MWException.php
index 478fead1..c0186f9f 100644
--- a/includes/exception/MWException.php
+++ b/includes/exception/MWException.php
@@ -238,8 +238,7 @@ class MWException extends Exception {
} elseif ( self::isCommandLine() ) {
MWExceptionHandler::printError( $this->getText() );
} else {
- self::header( 'HTTP/1.1 500 MediaWiki exception' );
- self::header( 'Status: 500 MediaWiki exception' );
+ self::statusHeader( 500 );
self::header( "Content-Type: $wgMimeType; charset=utf-8" );
$this->reportHTML();
@@ -266,4 +265,9 @@ class MWException extends Exception {
header( $header );
}
}
+ private static function statusHeader( $code ) {
+ if ( !headers_sent() ) {
+ HttpStatus::header( $code );
+ }
+ }
}