From 67ae889160d04e259bac5674f0a1f874a49c3c90 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 31 Mar 2015 09:17:43 +0000 Subject: [PATCH] WPDB: When we're checking to see if the MySQL client library supports `utf8mb4`, we need a separate check for `mysqlnd` versions, which using different version numbering to `libmysqlclient`. Props MattyRob. Fixes #31644. git-svn-id: https://develop.svn.wordpress.org/trunk@31939 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index ae0ec7ec94..91ad6f2286 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -2810,7 +2810,16 @@ class wpdb { $client_version = mysql_get_client_info(); } - return version_compare( $client_version, '5.5.3', '>=' ); + /* + * libmysql has supported utf8mb4 since 5.5.3, same as the MySQL server. + * mysqlnd has supported utf8mb4 since 5.0.9. + */ + if ( false !== strpos( $client_version, 'mysqlnd' ) ) { + $client_version = preg_replace( '/^\D+([\d.]+).*/', '$1', $client_version ); + return version_compare( $client_version, '5.0.9', '>=' ); + } else { + return version_compare( $client_version, '5.5.3', '>=' ); + } } return false;