From fc7a7b8972ff0d8732f324819d9c5dc530484fcb Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 2 Dec 2013 00:09:10 +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. Built from https://develop.svn.wordpress.org/trunk@26512 git-svn-id: http://core.svn.wordpress.org/trunk@26405 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 068351b766..9fcd4a7cab 100644 --- a/wp-includes/wp-db.php +++ b/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 ); }