From 8233227667026da65bf5af429ddf60d0f3235f16 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 15 Mar 2016 03:27:14 +0000 Subject: [PATCH] WPDB: Reset connection status variables when the connection is closed. Fixes #36240. git-svn-id: https://develop.svn.wordpress.org/trunk@36997 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 2 ++ tests/phpunit/tests/db.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index 6a8893ad7f..a30afa989d 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -3116,6 +3116,8 @@ class wpdb { if ( $closed ) { $this->dbh = null; + $this->ready = false; + $this->has_connected = false; } return $closed; diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index 583dba1d22..f49a3e07b6 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -946,6 +946,9 @@ class Tests_DB extends WP_UnitTestCase { $this->assertTrue( $wpdb->close() ); $this->assertFalse( $wpdb->close() ); + $this->assertFalse( $wpdb->ready ); + $this->assertFalse( $wpdb->has_connected ); + $wpdb->check_connection(); $this->assertTrue( $wpdb->close() );