From ca6321d4c6f36dffb7ed323380786a6851472b76 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Wed, 2 Aug 2006 18:48:30 +0000 Subject: [PATCH] erghhhh --- includes/GlobalFunctions.php | 14 ++++++++++++++ includes/StubObject.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index c34b7db1e6..9e4a453e85 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2047,4 +2047,18 @@ function wfGetPrecompiledData( $name ) { return false; } +function wfGetCaller( $level = 1 ) { + $backtrace = debug_backtrace(); + if ( isset( $backtrace[$level] ) ) { + if ( isset( $backtrace[$level]['class'] ) ) { + $caller = $backtrace[$level]['class'] . '::' . $backtrace[$level]['function']; + } else { + $caller = $backtrace[$level]['function']; + } + } else { + $caller = 'unknown'; + } + return $caller; +} + ?> diff --git a/includes/StubObject.php b/includes/StubObject.php index c54b114b7b..7225c24f13 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -49,7 +49,7 @@ class StubObject { if ( get_class( $GLOBALS[$this->mGlobal] ) != $this->mClass ) { $fname = __METHOD__.'-'.$this->mGlobal; wfProfileIn( $fname ); - $caller = Profiler::getCaller( $level ); + $caller = wfGetCaller( $level ); if ( ++$recursionLevel > 2 ) { throw new MWException( "Unstub loop detected on call of \${$this->mGlobal}->$name from $caller\n" ); } -- 2.20.1