Set the status code to 500 on exceptions.
authorPlatonides <platonides@gmail.com>
Thu, 31 May 2012 17:15:33 +0000 (19:15 +0200)
committerPlatonides <platonides@gmail.com>
Thu, 31 May 2012 17:15:33 +0000 (19:15 +0200)
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

includes/Exception.php

index 9c472bf..9f6d5bd 100644 (file)
@@ -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();
                }
        }