From: Alexandre Emsenhuber Date: Sat, 26 Apr 2008 19:09:04 +0000 (+0000) Subject: tweaks for r33917: X-Git-Tag: 1.31.0-rc.0~48054 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=4d3e46bfd10fc9a4978b0154eb960f9d87808bec;p=lhc%2Fweb%2Fwiklou.git tweaks for r33917: * use level 1 to get file and line, this from where the deprecated function was called * added class if available --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 3d77f8b557..5a1b47a72f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2511,12 +2511,20 @@ function wfMaxlagError( $host, $lag, $maxLag ) { * @return null */ function wfDeprecated( $function ) { - $callers = debug_backtrace(); - $file = @$callers[2]['file']; - $line = @$callers[2]['line']; - $func = @$callers[2]['function']; - if ( $func && $file ) { - trigger_error( "Use of $function is deprecated. Called from $func at $file:$line", E_USER_NOTICE ); + $callers = wfDebugBacktrace(); + if( isset( $callers[2] ) ){ + $callerfunc = $callers[2]; + $callerfile = $callers[1]; + if( isset( $callerfile['file'] ) && isset( $callerfile['line'] ) ){ + $file = $callerfile['file'] . ' at line ' . $callerfile['line']; + } else { + $file = '(internal function)'; + } + $func = ''; + if( isset( $callerfunc['class'] ) ) + $func .= $callerfunc['class'] . '::'; + $func .= @$callerfunc['function']; + trigger_error( "Use of $function is deprecated. Called from $func in $file", E_USER_NOTICE ); } else { trigger_error( "Use of $function is deprecated.", E_USER_NOTICE ); }