diff options
Diffstat (limited to 'wp-includes/class-wpdb.php')
-rw-r--r-- | wp-includes/class-wpdb.php | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/wp-includes/class-wpdb.php b/wp-includes/class-wpdb.php index d9186b9..aeb9679 100644 --- a/wp-includes/class-wpdb.php +++ b/wp-includes/class-wpdb.php @@ -878,15 +878,10 @@ class wpdb { return compact( 'charset', 'collate' ); } - if ( 'utf8' === $charset && $this->has_cap( 'utf8mb4' ) ) { + if ( 'utf8' === $charset ) { $charset = 'utf8mb4'; } - if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) { - $charset = 'utf8'; - $collate = str_replace( 'utf8mb4_', 'utf8_', $collate ); - } - if ( 'utf8mb4' === $charset ) { // _general_ is outdated, so we can upgrade it to _unicode_, instead. if ( ! $collate || 'utf8_general_ci' === $collate ) { @@ -3242,11 +3237,6 @@ class wpdb { if ( ! empty( $column->Collation ) ) { list( $charset ) = explode( '_', $column->Collation ); - // If the current connection can't support utf8mb4 characters, let's only send 3-byte utf8 characters. - if ( 'utf8mb4' === $charset && ! $this->has_cap( 'utf8mb4' ) ) { - $charset = 'utf8'; - } - $charsets[ strtolower( $charset ) ] = true; } @@ -4057,6 +4047,7 @@ class wpdb { * @since 4.1.0 Added support for the 'utf8mb4' feature. * @since 4.6.0 Added support for the 'utf8mb4_520' feature. * @since 6.2.0 Added support for the 'identifier_placeholders' feature. + * @since 6.6.0 The `utf8mb4` feature now always returns true. * * @see wpdb::db_version() * @@ -4092,26 +4083,7 @@ class wpdb { case 'set_charset': return version_compare( $db_version, '5.0.7', '>=' ); case 'utf8mb4': // @since 4.1.0 - if ( version_compare( $db_version, '5.5.3', '<' ) ) { - return false; - } - - $client_version = mysqli_get_client_info(); - - /* - * libmysql has supported utf8mb4 since 5.5.3, same as the MySQL server. - * mysqlnd has supported utf8mb4 since 5.0.9. - * - * Note: str_contains() is not used here, as this file can be included - * directly outside of WordPress core, e.g. by HyperDB, in which case - * the polyfills from wp-includes/compat.php are not loaded. - */ - 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 true; case 'utf8mb4_520': // @since 4.6.0 return version_compare( $db_version, '5.6', '>=' ); case 'identifier_placeholders': // @since 6.2.0 |