Ensure that wpdb::get_results() always returns an array when it should. Fixes #10607 props miqrogroove.

git-svn-id: http://svn.automattic.com/wordpress/trunk@13671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-03-11 21:30:29 +00:00
parent da3765da55
commit bb2fb8cb34
1 changed files with 14 additions and 6 deletions

View File

@ -444,6 +444,15 @@ class wpdb {
*/
var $dbuser;
/**
* A textual description of the last query/get_row/get_var call
*
* @since unknown
* @access public
* @var string
*/
var $func_call;
/**
* Connects to the database server and selects a database
*
@ -1387,20 +1396,19 @@ class wpdb {
} elseif ( $output == ARRAY_A || $output == ARRAY_N ) {
// Return an integer-keyed array of...
if ( $this->last_result ) {
$i = 0;
foreach( (array) $this->last_result as $row ) {
if ( $output == ARRAY_N ) {
// ...integer-keyed row arrays
$new_array[$i] = array_values( get_object_vars( $row ) );
$new_array[] = array_values( get_object_vars( $row ) );
} else {
// ...column name-keyed row arrays
$new_array[$i] = get_object_vars( $row );
$new_array[] = get_object_vars( $row );
}
++$i;
}
return $new_array;
}
return $new_array;
}
return null;
}
/**
@ -1569,4 +1577,4 @@ if ( ! isset($wpdb) ) {
*/
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
}
?>
?>