From: Niklas Laxström Date: Fri, 10 Dec 2010 12:03:39 +0000 (+0000) Subject: Don't unstub $wgOut just for adding debug messages X-Git-Tag: 1.31.0-rc.0~33400 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22messagerie%22%29%20.%20%22?a=commitdiff_plain;h=81791368a8d400242baecaa122adf9b8386d415f;p=lhc%2Fweb%2Fwiklou.git Don't unstub $wgOut just for adding debug messages --- 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