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
This commit is contained in:
Gary Pendergast 2014-12-01 00:02:55 +00:00
parent 5817aa262d
commit 6eebbc5750
1 changed files with 2 additions and 2 deletions

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++;