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

git-svn-id: https://develop.svn.wordpress.org/trunk@13671 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2010-03-11 21:30:29 +00:00
parent bb7b2b24a8
commit fe8462294a
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);
}
?>
?>