From: Platonides Date: Sat, 18 Jun 2011 20:11:45 +0000 (+0000) Subject: There is a nice $limit parameter in PHP 5.4, but calling debug_backtrace on earlier... X-Git-Tag: 1.31.0-rc.0~29433 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=1f71f306a390fffee7b6f199a86827f50b03e50c;p=lhc%2Fweb%2Fwiklou.git 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. --- 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 ); + } } /**