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.



git-svn-id: https://develop.svn.wordpress.org/trunk@30299 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2014-11-11 02:16:19 +00:00
parent df11fb8593
commit c2fb136b47
1 changed files with 5 additions and 0 deletions

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