[wp-trac] [WordPress Trac] #60002: maybe_convert_table_to_utf8mb4() not work with new version of MySQL/MariaDB.
WordPress Trac
noreply at wordpress.org
Sat Dec 2 08:00:36 UTC 2023
#60002: maybe_convert_table_to_utf8mb4() not work with new version of
MySQL/MariaDB.
--------------------------+-----------------------------
Reporter: okvee | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
From [this document](https://mariadb.com/kb/en/unicode/). They said:
''From MariaDB 10.6, utf8 is by default an alias for utf8mb3''
And from [this document](https://dev.mysql.com/doc/refman/8.0/en/charset-
unicode-utf8mb3.html) in MySQL. They said:
''Historically, MySQL has used utf8 as an alias for utf8mb3; beginning
with MySQL 8.0.28, utf8mb3 is used exclusively in the output of SHOW
statements and in Information Schema tables when this character set is
meant.''
It can be refer to [this
issue](https://core.trac.wordpress.org/changeset/53918).
So, from this simple MySQL code:
{{{
CREATE TABLE testing (
id bigint(20) NOT NULL AUTO_INCREMENT,
name varchar(50) DEFAULT NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
}}}
If you run on MariaDB 10.6 or newer (for me it is 10.6.7) the `utf8`
column will be automatically changed to `utf8mb3_general_ci`.
But, WordPress function `maybe_convert_table_to_utf8mb4()` contain this
condition:
{{{#!php
<?php
if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
// Don't upgrade tables that have non-utf8 columns.
return false;
}
}}}
Which will be result in no change from `utf8mb3_general_ci` to
`utf8mb4_unicode_ci`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60002>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list