$args = array_slice( func_get_args(), 2 );
if ( $this->useMessageCache() ) {
- return wfMessage( $key, $args )->text();
- } else {
- return wfMsgReplaceArgs( $fallback, $args );
+ try {
+ return wfMessage( $key, $args )->text();
+ } catch ( Exception $e ) {
+ }
}
+ return wfMsgReplaceArgs( $fallback, $args );
}
/**
nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
"</p>\n";
} else {
+ $logId = MWExceptionHandler::getLogId( $this );
+ $type = get_class( $this );
return "<div class=\"errorbox\">" .
- '[' . MWExceptionHandler::getLogId( $this ) . '] ' .
- gmdate( 'Y-m-d H:i:s' ) .
- ": Fatal exception of type " . get_class( $this ) . "</div>\n" .
+ '[' . $logId . '] ' .
+ gmdate( 'Y-m-d H:i:s' ) . ": " .
+ $this->msg( "internalerror-fatal-exception",
+ "Fatal exception of type $1",
+ $type,
+ $logId,
+ MWExceptionHandler::getURL( $this )
+ ) . "</div>\n" .
"<!-- Set \$wgShowExceptionDetails = true; " .
"at the bottom of LocalSettings.php to show detailed " .
"debugging information. -->";
} 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();
header( $header );
}
}
+ private static function statusHeader( $code ) {
+ if ( !headers_sent() ) {
+ HttpStatus::header( $code );
+ }
+ }
}