From: umherirrender Date: Tue, 14 Aug 2012 20:00:04 +0000 (+0200) Subject: output errors as debug info in api, when display_errors is on X-Git-Tag: 1.31.0-rc.0~22733^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=25ce55175dde2e5a7af4982e45aad119aa964ccc;p=lhc%2Fweb%2Fwiklou.git output errors as debug info in api, when display_errors is on With format=xml errors never outputted, only in the html version Change-Id: I4364cee041ea42ed3a4ab43ac77a1ba3cc2cb886 --- diff --git a/includes/debug/Debug.php b/includes/debug/Debug.php index 5330a4bbec..1ad25aece2 100644 --- a/includes/debug/Debug.php +++ b/includes/debug/Debug.php @@ -312,6 +312,18 @@ class MWDebug { return; } + // output errors as debug info, when display_errors is on + // this is necessary for all non html output of the api, because that clears all errors first + $obContents = ob_get_contents(); + if( $obContents ) { + $obContentArray = explode( '
', $obContents ); + foreach( $obContentArray as $obContent ) { + if( trim( $obContent ) ) { + self::debugMsg( Sanitizer::stripAllTags( $obContent ) ); + } + } + } + MWDebug::log( 'MWDebug output complete' ); $debugInfo = self::getDebugInfo( $context );