From 87e9fc60349ad735052ee2b0280f286f31a23cde Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sat, 26 Apr 2008 17:57:29 +0000 Subject: [PATCH] * Print caller if possible in deprecated warnings --- includes/GlobalFunctions.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 7497b22009..94a1508488 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2506,7 +2506,15 @@ function wfMaxlagError( $host, $lag, $maxLag ) { * @return null */ function wfDeprecated( $function ) { - trigger_error( "Use of $function is deprecated", E_USER_NOTICE ); + $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 ); + } else { + trigger_error( "Use of $function is deprecated.", E_USER_NOTICE ); + } } /** -- 2.20.1