Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#39273 new defect (bug)

Updating to 4.7 can break serialized data because $wpdb->determine_charset now forces utf8 when DB_CHARSET is set to utf8mb4

Reported by: justinbusa's profile justinbusa Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Database Keywords: dev-feedback
Focuses: Cc:


I've seen this happen several times now. DB_CHARSET is defined as utf8mb4 and the columns in the database are set to utf8mb4_unicode_ci. However, the changes in 38581 are now forcing utf8 causing the serialized array lengths to change when the data is queried and breaking them because the charsets don't match.

I can't say for certain because I'm debugging this issue on a site that isn't mine, but I don't think anyone explicitly set DB_CHARSET to utf8mb4 in wp-config.php. It appears that at one point, WordPress set that define and created (or updated) those tables to utf8mb4_unicode_ci.

Deleting the DB_CHARSET define fixes the issue but that doesn't seem like an ideal solution for users who update and end up with a broken site.

I'll admit this is a bit over my head, so I'm hoping someone smarter than me might be able to chime in with some more info :) I'm definitely available to keep the conversation going. Thanks!

Change History (1)

#1 @justinbusa
7 years ago

  • Keywords dev-feedback added
Note: See TracTickets for help on using tickets.