From: Brion Vibber Date: Tue, 18 Jan 2005 10:24:33 +0000 (+0000) Subject: * Fix notice errors in wfDebugDieBacktrace() in XML callbacks X-Git-Tag: 1.5.0alpha1~896 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=e95815ddfff13ccd6027512eb24dad79be7636cc;p=lhc%2Fweb%2Fwiklou.git * Fix notice errors in wfDebugDieBacktrace() in XML callbacks * Suppress notice error on bogus timestamp input (returns epoch as before) --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index abe9f36937..143bb96dd8 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -475,12 +475,21 @@ function wfDebugDieBacktrace( $msg = '' ) { } $backtrace = debug_backtrace(); foreach( $backtrace as $call ) { - $f = explode( DIRECTORY_SEPARATOR, $call['file'] ); - $file = $f[count($f)-1]; + if( isset( $call['file'] ) ) { + $f = explode( DIRECTORY_SEPARATOR, $call['file'] ); + $file = $f[count($f)-1]; + } else { + $file = '-'; + } + if( isset( $call['line'] ) ) { + $line = $call['line']; + } else { + $line = '-'; + } if ( $wgCommandLineMode ) { - $msg .= "$file line {$call['line']} calls "; + $msg .= "$file line $line calls "; } else { - $msg .= '
  • ' . $file . ' line ' . $call['line'] . ' calls '; + $msg .= '
  • ' . $file . ' line ' . $line . ' calls '; } if( !empty( $call['class'] ) ) $msg .= $call['class'] . '::'; $msg .= $call['function'] . '()'; @@ -1017,6 +1026,10 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) { } elseif (preg_match("/^(\d{1,13})$/",$ts,$datearray)) { # TS_UNIX $uts=$ts; + } else { + # Bogus value; fall back to the epoch... + wfDebug("wfTimestamp() given bogus time value.\n"); + $uts = 0; } if ($ts==0) @@ -1031,7 +1044,7 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) { case TS_RFC2822: return gmdate( "D, j M Y H:i:s", $uts ) . ' GMT'; default: - return; + wfDebugDieBacktrace( 'wfTimestamp() called with illegal output type.'); } }