WPDB: Before fetching results, make sure we have a valid result resource to fetch them from.

Fixes #27982.

Built from https://develop.svn.wordpress.org/trunk@30677


git-svn-id: http://core.svn.wordpress.org/trunk@30667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2014-12-01 00:03:22 +00:00
parent a215b8801d
commit a0c12d0c61
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-beta2-30676';
$wp_version = '4.1-beta2-30677';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -1668,12 +1668,12 @@ class wpdb {
$return_val = $this->rows_affected;
} else {
$num_rows = 0;
if ( $this->use_mysqli ) {
if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
while ( $row = @mysqli_fetch_object( $this->result ) ) {
$this->last_result[$num_rows] = $row;
$num_rows++;
}
} else {
} else if ( is_resource( $this->result ) ) {
while ( $row = @mysql_fetch_object( $this->result ) ) {
$this->last_result[$num_rows] = $row;
$num_rows++;