From 6eebbc57507f5019356c5416e8fcc2857489031a Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 1 Dec 2014 00:02:55 +0000 Subject: [PATCH] WPDB: Before fetching results, make sure we have a valid result resource to fetch them from. Fixes #27982. git-svn-id: https://develop.svn.wordpress.org/trunk@30677 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index c1b6f56477..4a875b563d 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -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++;