From 1f71f306a390fffee7b6f199a86827f50b03e50c Mon Sep 17 00:00:00 2001 From: Platonides Date: Sat, 18 Jun 2011 20:11:45 +0000 Subject: [PATCH] There is a nice $limit parameter in PHP 5.4, but calling debug_backtrace on earlier versions with too much parameters, it errors returning null, so we need a PHP_VERSION comparison. --- includes/GlobalFunctions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index f1b6ce90c0..67f5e2848b 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1381,7 +1381,11 @@ function wfDebugBacktrace() { return array(); } - return array_slice( debug_backtrace(), 1 ); + if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) { + return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, 1 ), 1 ); + } else { + return array_slice( debug_backtrace(), 1 ); + } } /** -- 2.20.1