From: Platonides Date: Thu, 31 May 2012 17:15:33 +0000 (+0200) Subject: Set the status code to 500 on exceptions. X-Git-Tag: 1.31.0-rc.0~23438^2 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=3e59f15bb0681ce951d40622d0fe73291e42ffbc;p=lhc%2Fweb%2Fwiklou.git Set the status code to 500 on exceptions. Should fix bug 37140, scripts served through action=raw failing due to being served a html error page. As well as such as giving a better behavior such as for search engines. This could affect IE users by showing them smart errors instead of the content, though. Change-Id: I5d680fe10db6d61d91e898323bd5fb755a07135d --- diff --git a/includes/Exception.php b/includes/Exception.php index 9c472bf9df..9f6d5bdc6b 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -246,6 +246,9 @@ class MWException extends Exception { } elseif ( self::isCommandLine() ) { MWExceptionHandler::printError( $this->getText() ); } else { + header( "HTTP/1.1 500 MediaWiki exception" ); + header( "Status: 500 MediaWiki exception", true ); + $this->reportHTML(); } }