From 653ab71610e1d18688635fe736538a4c9c6bdab2 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Wed, 14 Nov 2007 22:11:33 +0000 Subject: [PATCH] remove use of anon function in stacktrace parsing, repeated calls are far more friendly for proper functions --- includes/GlobalFunctions.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 312d1903dd..a8fbb39853 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2181,11 +2181,7 @@ function wfGetPrecompiledData( $name ) { function wfGetCaller( $level = 2 ) { $backtrace = wfDebugBacktrace(); if ( isset( $backtrace[$level] ) ) { - if ( isset( $backtrace[$level]['class'] ) ) { - $caller = $backtrace[$level]['class'] . '::' . $backtrace[$level]['function']; - } else { - $caller = $backtrace[$level]['function']; - } + return wfFormatStackFrame($backtrace[$level]); } else { $caller = 'unknown'; } @@ -2194,13 +2190,14 @@ function wfGetCaller( $level = 2 ) { /** Return a string consisting all callers in stack, somewhat useful sometimes for profiling specific points */ function wfGetAllCallers() { - return implode('/', array_map( - create_function('$frame',' - return isset( $frame["class"] )? - $frame["class"]."::".$frame["function"]: - $frame["function"]; - '), - array_reverse(wfDebugBacktrace()))); + return implode('/', array_map('wfFormatStackFrame',array_reverse(wfDebugBacktrace()))); +} + +/** Return a string representation of frame */ +function wfFormatStackFrame($frame) { + return isset( $frame["class"] )? + $frame["class"]."::".$frame["function"]: + $frame["function"]; } /** -- 2.20.1