From 4c9e7f81e18480cfd879b7529e44cc40cc5c0180 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 26 Feb 2014 04:15:18 +0000 Subject: [PATCH] wpdb: set dbh to null when the mysqli connection fails. see #21663. Built from https://develop.svn.wordpress.org/trunk@27277 git-svn-id: http://core.svn.wordpress.org/trunk@27133 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 667ee3b25a..4bba086d3f 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1327,6 +1327,10 @@ class wpdb { } else { @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); } + + if ( $this->dbh->connect_errno ) { + $this->dbh = null; + } } else { if ( WP_DEBUG ) { $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );