Fixed spacing in files direct in includes folder
[lhc/web/wiklou.git] / includes / Exception.php
index dc34320..b42ae99 100644 (file)
@@ -247,7 +247,7 @@ class MWException extends Exception {
         * It will be either HTML or plain text based on isCommandLine().
         */
        function report() {
-               global $wgLogExceptionBacktrace;
+               global $wgLogExceptionBacktrace, $wgMimeType;
                $log = $this->getLogMessage();
 
                if ( $log ) {
@@ -267,6 +267,7 @@ class MWException extends Exception {
                } else {
                        header( "HTTP/1.1 500 MediaWiki exception" );
                        header( "Status: 500 MediaWiki exception", true );
+                       header( "Content-Type: $wgMimeType; charset=utf-8", true );
 
                        $this->reportHTML();
                }
@@ -332,7 +333,7 @@ class ErrorPageError extends MWException {
                // customized by the local wiki. So get the default English version for
                // passing to the parent constructor. Our overridden report() below
                // makes sure that the page shown to the user is not forced to English.
-               if( $msg instanceof Message ) {
+               if ( $msg instanceof Message ) {
                        $enMsg = clone( $msg );
                } else {
                        $enMsg = wfMessage( $msg, $params );
@@ -477,7 +478,7 @@ class UserBlockedError extends ErrorPageError {
                }
 
                $reason = $block->mReason;
-               if( $reason == '' ) {
+               if ( $reason == '' ) {
                        $reason = wfMessage( 'blockednoreason' )->text();
                }
 
@@ -616,7 +617,7 @@ class HttpError extends MWException {
                        $content = htmlspecialchars( $this->content );
                }
 
-               return "<!DOCTYPE html>\n".
+               return "<!DOCTYPE html>\n" .
                        "<html><head><title>$header</title></head>\n" .
                        "<body><h1>$header</h1><p>$content</p></body></html>\n";
        }
@@ -720,8 +721,10 @@ class MWExceptionHandler {
                // Final cleanup
                if ( $wgFullyInitialised ) {
                        try {
-                               wfLogProfilingData(); // uses $wgRequest, hence the $wgFullyInitialised condition
-                       } catch ( Exception $e ) {}
+                               // uses $wgRequest, hence the $wgFullyInitialised condition
+                               wfLogProfilingData();
+                       } catch ( Exception $e ) {
+                       }
                }
 
                // Exit value should be nonzero for the benefit of shell jobs