diff --git a/wp-includes/version.php b/wp-includes/version.php index fc30f64eb6..505a106eec 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.1-alpha-30296'; +$wp_version = '4.1-alpha-30297'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 2e8b4079fe..f01ba97a8c 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1322,12 +1322,16 @@ class wpdb { $this->rows_affected = $this->num_rows = 0; $this->last_error = ''; - if ( is_resource( $this->result ) ) { - if ( $this->use_mysqli ) { - mysqli_free_result( $this->result ); - } else { - mysql_free_result( $this->result ); + if ( $this->use_mysqli && $this->result instanceof mysqli_result ) { + mysqli_free_result( $this->result ); + $this->result = null; + + // Clear out any results from a multi-query + while ( mysqli_more_results( $this->dbh ) ) { + mysqli_next_result( $this->dbh ); } + } else if ( is_resource( $this->result ) ) { + mysql_free_result( $this->result ); } }