From 81791368a8d400242baecaa122adf9b8386d415f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Fri, 10 Dec 2010 12:03:39 +0000 Subject: [PATCH] Don't unstub $wgOut just for adding debug messages --- includes/GlobalFunctions.php | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 79ecb121d0..72a9f2772f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -297,7 +297,6 @@ function wfUrlencode( $s ) { function wfDebug( $text, $logonly = false ) { global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage; global $wgDebugLogPrefix, $wgShowDebug; - static $recursion = 0; static $cache = array(); // Cache of unoutputted messages $text = wfDebugTimer() . $text; @@ -310,21 +309,11 @@ function wfDebug( $text, $logonly = false ) { if ( ( $wgDebugComments || $wgShowDebug ) && !$logonly ) { $cache[] = $text; - if ( !isset( $wgOut ) ) { - return; - } - if ( !StubObject::isRealObject( $wgOut ) ) { - if ( $recursion ) { - return; - } - $recursion++; - $wgOut->_unstub(); - $recursion--; + if ( isset( $wgOut ) && StubObject::isRealObject( $wgOut ) ) { + // add the message and any cached messages to the output + array_map( array( $wgOut, 'debug' ), $cache ); + $cache = array(); } - - // add the message and possible cached ones to the output - array_map( array( $wgOut, 'debug' ), $cache ); - $cache = array(); } if ( $wgDebugLogFile != '' && !$wgProfileOnly ) { # Strip unprintables; they can switch terminal modes when binary data -- 2.20.1