wpdb: When flushing results on a mysqli connection, make sure that wpdb::$dbh is a valid mysqli connection handle.

Fixes a unit test failure introduced in [30297].

Fixes #28155.

Props soulseekah.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2014-11-11 02:17:28 +00:00
parent dd61164577
commit 21467af4db
2 changed files with 6 additions and 1 deletions

View File

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

View File

@ -1326,6 +1326,11 @@ class wpdb {
mysqli_free_result( $this->result );
$this->result = null;
// Sanity check before using the handle
if ( empty( $this->dbh ) || !( $this->dbh instanceof mysqli ) ) {
return;
}
// Clear out any results from a multi-query
while ( mysqli_more_results( $this->dbh ) ) {
mysqli_next_result( $this->dbh );