From 03cd4ad942ea7dee561091838a0798018553e251 Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Wed, 21 May 2008 04:59:21 +0000 Subject: [PATCH] Prevent two E_STRICT warnings when running "php maintenance/update.php" to update from 1.12 alpha to 1.13 alpha. -------------------------------------------------- # php maintenance/update.php MediaWiki 1.13alpha Updater Going to run database updates for wikidb Depending on the size of your database this may take a while! Abort with control-c in the next five seconds...0 Strict Standards: Type: 8: Undefined offset: 1 in wiki/includes/Database.php on line 1420 Database.tableName("ipblocks") # line 1164, file: wiki/includes/Database.php Database.tableExists("ipblocks") # line 203, file: wiki/maintenance/updaters.inc add_field("ipblocks", "ipb_id", "patch-ipblocks.sql") # line unknown, file: unknown call_user_func_array("add_field", Array[3]) # line 1051, file: wiki/maintenance/updaters.inc do_all_updates(false, true) # line 60, file: wiki/maintenance/update.php [ ... snip same warning repeated thousands of times ... ] -------------------------------------------------- ... also ... : -------------------------------------------------- Strict Standards: Type: 8: Undefined index: USE INDEX in wiki/includes/Database.php on line 977 Database.selectSQLText(Array[2], Array[2], Array[3], "Database::select", Array[0], Array[0]) # line 952, file: wiki/includes/Database.php Database.select(Array[2], Array[2], Array[3]) # line 32, file: wiki/maintenance/deleteDefaultMessages.php deleteDefaultMessages() # line 1077, file: wiki/maintenance/updaters.inc do_all_updates(false, true) # line 60, file: wiki/maintenance/update.php -------------------------------------------------- --- includes/Database.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/Database.php b/includes/Database.php index 84b6b26e94..67858f0c65 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -974,7 +974,7 @@ class Database { $options = array( $options ); } if( is_array( $table ) ) { - if ( !empty($join_conds) || is_array( @$options['USE INDEX'] ) ) + if ( !empty($join_conds) || ( isset( $options['USE INDEX'] ) && is_array( @$options['USE INDEX'] ) ) ) $from = ' FROM ' . $this->tableNamesWithUseIndexOrJOIN( $table, @$options['USE INDEX'], $join_conds ); else $from = ' FROM ' . implode( ',', array_map( array( &$this, 'tableName' ), $table ) ); @@ -1417,7 +1417,9 @@ class Database { # Split database and table into proper variables. # We reverse the explode so that database.table and table both output # the correct table. - @list( $table, $database ) = array_reverse( explode( '.', $name, 2 ) ); + $dbDetails = array_reverse( explode( '.', $name, 2 ) ); + if( isset( $dbDetails[1] ) ) @list( $table, $database ) = $dbDetails; + else @list( $table ) = $dbDetails; $prefix = $this->mTablePrefix; # Default prefix # A database name has been specified in input. Quote the table name -- 2.20.1