From: Brion Vibber Date: Mon, 17 Nov 2008 18:51:21 +0000 (+0000) Subject: * Safer handling of non-MediaWiki exceptions -- now obeys our settings for formatting... X-Git-Tag: 1.31.0-rc.0~44313 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=5fe9c4363eed213142616baa906ec9323b231191;p=lhc%2Fweb%2Fwiklou.git * Safer handling of non-MediaWiki exceptions -- now obeys our settings for formatting and path exposure. Applying Tim's fixes... --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e451dd7d5a..feb6aa1401 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Exception.php b/includes/Exception.php index 05ddfd107a..eb7159861c 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -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"; + } } }