Don't suppress error messages in database function calls.

Fixes #21870.


git-svn-id: https://develop.svn.wordpress.org/trunk@35860 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
ericlewis 2015-12-11 03:39:52 +00:00
parent 957697adf0
commit 26e7188154
1 changed files with 16 additions and 24 deletions

View File

@ -1044,9 +1044,9 @@ class wpdb {
$dbh = $this->dbh;
if ( $this->use_mysqli ) {
$success = @mysqli_select_db( $dbh, $db );
$success = mysqli_select_db( $dbh, $db );
} else {
$success = @mysql_select_db( $db, $dbh );
$success = mysql_select_db( $db, $dbh );
}
if ( ! $success ) {
$this->ready = false;
@ -1484,11 +1484,7 @@ class wpdb {
}
}
if ( WP_DEBUG ) {
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
} else {
@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
}
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
if ( $this->dbh->connect_errno ) {
$this->dbh = null;
@ -1514,11 +1510,7 @@ class wpdb {
}
}
} else {
if ( WP_DEBUG ) {
$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
} else {
$this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
}
$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
}
if ( ! $this->dbh && $allow_bail ) {
@ -1589,11 +1581,11 @@ class wpdb {
*/
public function check_connection( $allow_bail = true ) {
if ( $this->use_mysqli ) {
if ( @mysqli_ping( $this->dbh ) ) {
if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) {
return true;
}
} else {
if ( @mysql_ping( $this->dbh ) ) {
if ( ! empty( $this->dbh ) && mysql_ping( $this->dbh ) ) {
return true;
}
}
@ -1770,12 +1762,12 @@ class wpdb {
} else {
$num_rows = 0;
if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
while ( $row = @mysqli_fetch_object( $this->result ) ) {
while ( $row = mysqli_fetch_object( $this->result ) ) {
$this->last_result[$num_rows] = $row;
$num_rows++;
}
} elseif ( is_resource( $this->result ) ) {
while ( $row = @mysql_fetch_object( $this->result ) ) {
while ( $row = mysql_fetch_object( $this->result ) ) {
$this->last_result[$num_rows] = $row;
$num_rows++;
}
@ -1805,10 +1797,10 @@ class wpdb {
$this->timer_start();
}
if ( $this->use_mysqli ) {
$this->result = @mysqli_query( $this->dbh, $query );
} else {
$this->result = @mysql_query( $query, $this->dbh );
if ( ! empty( $this->dbh ) && $this->use_mysqli ) {
$this->result = mysqli_query( $this->dbh, $query );
} elseif ( ! empty( $this->dbh ) ) {
$this->result = mysql_query( $query, $this->dbh );
}
$this->num_queries++;
@ -3016,14 +3008,14 @@ class wpdb {
return;
if ( $this->use_mysqli ) {
$num_fields = @mysqli_num_fields( $this->result );
$num_fields = mysqli_num_fields( $this->result );
for ( $i = 0; $i < $num_fields; $i++ ) {
$this->col_info[ $i ] = @mysqli_fetch_field( $this->result );
$this->col_info[ $i ] = mysqli_fetch_field( $this->result );
}
} else {
$num_fields = @mysql_num_fields( $this->result );
$num_fields = mysql_num_fields( $this->result );
for ( $i = 0; $i < $num_fields; $i++ ) {
$this->col_info[ $i ] = @mysql_fetch_field( $this->result, $i );
$this->col_info[ $i ] = mysql_fetch_field( $this->result, $i );
}
}
}