From 343b2b12510305fce756c33f1cdbf9400ec554e2 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 15 Feb 2010 10:00:39 +0000 Subject: [PATCH] Init array in wpdb:get_results() and get_col_info(). Props UnderWordPressure, miqrogroove, fixes #10607 git-svn-id: https://develop.svn.wordpress.org/trunk@13161 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/wp-db.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index d6e844d9d3..2970426e95 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1059,6 +1059,7 @@ class wpdb { else return null; + $new_array = array(); if ( $output == OBJECT ) { // Return an integer-keyed array of row objects return $this->last_result; @@ -1103,6 +1104,7 @@ class wpdb { if ( $this->col_info ) { if ( $col_offset == -1 ) { $i = 0; + $new_array = array(); foreach( (array) $this->col_info as $col ) { $new_array[$i] = $col->{$info_type}; $i++; @@ -1173,8 +1175,7 @@ class wpdb { * * @return WP_Error */ - function check_database_version() - { + function check_database_version() { global $wp_version, $required_mysql_version; // Make sure the server has the required MySQL version if ( version_compare($this->db_version(), $required_mysql_version, '<') )