* Safer handling of non-MediaWiki exceptions -- now obeys our settings for formatting...
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 17 Nov 2008 18:51:21 +0000 (18:51 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 17 Nov 2008 18:51:21 +0000 (18:51 +0000)
Applying Tim's fixes...

RELEASE-NOTES
includes/Exception.php

index e451dd7..feb6aa1 100644 (file)
@@ -344,6 +344,9 @@ The following extensions are migrated into MediaWiki 1.14:
 * (bug 5530) Consistency between character encoding in {{PAGENAMEE}},
   {{SUBPAGENAMEE}} and {{FULLPAGENAMEE}}
 * API siteinfo query no longer throws an exception for empty sifilter parameter.
+* Safer handling of non-MediaWiki exceptions -- now obeys our settings for
+  formatting and path exposure.
+
 
 === API changes in 1.14 ===
 
index 05ddfd1..eb71598 100644 (file)
@@ -283,7 +283,16 @@ function wfReportException( Exception $e ) {
                         }
                 }
         } else {
-                echo $e->__toString();
+                $message = "Unexpected non-MediaWiki exception encountered, of type \"" . get_class( $e ) . "\"\n" .
+                        $e->__toString() . "\n";
+                if ( $GLOBALS['wgShowExceptionDetails'] ) {
+                        $message .= "\n" . $e->getTraceAsString() ."\n";
+                }
+                if ( !empty( $GLOBALS['wgCommandLineMode'] ) ) {
+                        wfPrintError( $message );
+                } else {
+                        echo nl2br( htmlspecialchars( $message ) ). "\n";
+                }
         }
 }