mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
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:
parent
da3765da55
commit
bb2fb8cb34
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user