From: Mr. E23 Date: Sun, 11 Jan 2004 23:50:52 +0000 (+0000) Subject: Removed a global variable. Added PHP < 4.3 compatibility for wfAbruptExit(). X-Git-Tag: 1.3.0beta1~1166 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=beaae16295d08ac21c0e0812b16301e305688ae1;p=lhc%2Fweb%2Fwiklou.git Removed a global variable. Added PHP < 4.3 compatibility for wfAbruptExit(). --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index e6e2b97922..63ad667fd7 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -343,29 +343,23 @@ function wfGo( $s ) $se->goResult(); } - -/* private */ $wgAbruptExitCalled = false; - # Just like exit() but makes a note of it. function wfAbruptExit(){ - // Safety to avoid infinite recursion in case of (unlikely) bugs somewhere - global $wgAbruptExitCalled; - if ( $wgAbruptExitCalled ){ + static $called = false; + if ( $called ){ exit(); } - $wgAbruptExitCalled = true; - - if( ! function_exists( "debug_backtrace" )){ // for php < 4.3.0 - wfDebug("WARNING: Abrupt exit from somewhere.\n"); - exit(); - } - - wfDebug("WARNING: Abrupt exit. Backtrace follows:\n"); - $bt = debug_backtrace(); - for($i = 0; $i < count($bt) ; $i++){ - $file = $bt[$i]["file"]; - $line = $bt[$i]["line"]; - wfDebug("Abrupt exit in $file at line $line\n"); + $called = true; + + if( function_exists( "debug_backtrace" ) ){ // PHP >= 4.3 + $bt = debug_backtrace(); + for($i = 0; $i < count($bt) ; $i++){ + $file = $bt[$i]["file"]; + $line = $bt[$i]["line"]; + wfDebug("WARNING: Abrupt exit in $file at line $line\n"); + } + } else { + wfDebug("WARNING: Abrupt exit\n"); } exit(); }