HttpError: Consistently escape document title
[lhc/web/wiklou.git] / includes / exception / MWException.php
index 6fd6fb5..478fead 100644 (file)
@@ -117,10 +117,12 @@ class MWException extends Exception {
                $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 );
        }
 
        /**
@@ -139,10 +141,17 @@ class MWException extends Exception {
                        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. -->";