From 3298541026905b7a65518bca0d8025961ce472b2 Mon Sep 17 00:00:00 2001 From: kolorafa Date: Wed, 30 Sep 2015 13:14:08 +0200 Subject: [PATCH] Failed to set charset mysqli_set_charset might fail to setup charset (like in my case). Wordpress should fallback to old method. --- wp-includes/wp-db.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index e52d6fd2f4eb..df39de1d93db 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -778,9 +778,7 @@ public function set_charset( $dbh, $charset = null, $collate = null ) { $collate = $this->collate; if ( $this->has_cap( 'collation' ) && ! empty( $charset ) ) { if ( $this->use_mysqli ) { - if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) { - mysqli_set_charset( $dbh, $charset ); - } else { + if (!( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) && mysqli_set_charset( $dbh, $charset ) )) { $query = $this->prepare( 'SET NAMES %s', $charset ); if ( ! empty( $collate ) ) $query .= $this->prepare( ' COLLATE %s', $collate );