From 50edc63cc9d7636d4e0a8e0f0409bbcbe2c5b29a Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 2 Dec 2013 00:08:57 +0000 Subject: [PATCH] When `WP_DEBUG` is set to `true`, suppress deprecated errors from firing when calling `mysql_connect()`, which is officially deprecated in PHP 5.5. We will remove this shameful code as soon as is humanly possible. Props wonderboymusic. Extra love to tierra and nacin. Fixes #26322. git-svn-id: https://develop.svn.wordpress.org/trunk@26512 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index 068351b766..9fcd4a7cab 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -1139,7 +1139,15 @@ class wpdb { $client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0; if ( WP_DEBUG ) { + $error_reporting = false; + if ( defined( 'E_DEPRECATED' ) ) { + $error_reporting = error_reporting(); + error_reporting( $error_reporting ^ E_DEPRECATED ); + } $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); + if ( false !== $error_reporting ) { + error_reporting( $error_reporting ); + } } else { $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); }