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
This commit is contained in:
Scott Taylor 2013-12-02 00:09:10 +00:00
parent ff6233b9c5
commit fc7a7b8972
1 changed files with 8 additions and 0 deletions

View File

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