From 51f738ea9a198d11e78cf030dce54f814fa8bc69 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 8 Mar 2004 02:50:04 +0000 Subject: [PATCH] More unitialized variable cleanup && 'pure' register_globals cleanup... Added wfDebugDieBacktrace() function to help in pinpointing problems by showing a function call backtrace along with a friendly die message. --- includes/GlobalFunctions.php | 35 ++++++++++++++++++++++++++++++----- includes/Parser.php | 27 ++++++++++++++++++++------- includes/Skin.php | 12 ++++++------ includes/Title.php | 3 +++ index.php | 15 +++++++++------ 5 files changed, 68 insertions(+), 24 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8322905e24..3fdba5e879 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -353,8 +353,13 @@ function wfSpecialPage() $wgOut->setArticleRelated( false ); $wgOut->setRobotpolicy( "noindex,follow" ); - $par = NULL; - list($t, $par) = split( "/", $wgTitle->getDBkey(), 2 ); + $bits = split( "/", $wgTitle->getDBkey(), 2 ); + $t = $bits[0]; + if( empty( $bits[1] ) ) { + $par = NULL; + } else { + $par = $bits[1]; + } if ( array_key_exists( $t, $validSP ) || ( $wgUser->isSysop() && array_key_exists( $t, $sysopSP ) ) || @@ -410,6 +415,19 @@ function wfAbruptExit(){ exit(); } +function wfDebugDieBacktrace( $msg = "" ) { + $msg .= "\n

Backtrace:

\n