exception: Use standard message for HTTP status 500
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 1 Jun 2015 14:02:50 +0000 (15:02 +0100)
committerBryanDavis <bdavis@wikimedia.org>
Wed, 3 Jun 2015 02:49:44 +0000 (02:49 +0000)
This is the only case in the MediaWiki code base where a custom
message is used. Supporting in the standard HttpStatus library
would require a $customMessage parameter which seems unnecessary.

Additional information should be communicated using additional
HTTP response headers or inside the body content.

Besides, in current PHP versions and in Apache 2.4, the message is
already being ignored and replaced with the standard message (see T100984).

Bug: T100984
Change-Id: I11b58a2f3ce22568479d36027d15e5c6f428ff15

includes/exception/MWException.php

index 478fead..e54e568 100644 (file)
@@ -238,8 +238,8 @@ 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::header( 'HTTP/1.1 500 Internal Server Error' );
+                       self::header( 'Status: 500 Internal Server Error' );
                        self::header( "Content-Type: $wgMimeType; charset=utf-8" );
 
                        $this->reportHTML();