output errors as debug info in api, when display_errors is on
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 14 Aug 2012 20:00:04 +0000 (22:00 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Tue, 14 Aug 2012 20:00:04 +0000 (22:00 +0200)
With format=xml errors never outputted, only in the html version

Change-Id: I4364cee041ea42ed3a4ab43ac77a1ba3cc2cb886

includes/debug/Debug.php

index 5330a4b..1ad25ae 100644 (file)
@@ -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( '<br />', $obContents );
+                       foreach( $obContentArray as $obContent ) {
+                               if( trim( $obContent ) ) {
+                                       self::debugMsg( Sanitizer::stripAllTags( $obContent ) );
+                               }
+                       }
+               }
+
                MWDebug::log( 'MWDebug output complete' );
                $debugInfo = self::getDebugInfo( $context );