[wp-trac] [WordPress Trac] #39273: Updating to 4.7 can break serialized data because $wpdb->determine_charset now forces utf8 when DB_CHARSET is set to utf8mb4

WordPress Trac noreply at wordpress.org
Wed Dec 14 05:05:59 UTC 2016


#39273: Updating to 4.7 can break serialized data because $wpdb->determine_charset
now forces utf8 when DB_CHARSET is set to utf8mb4
--------------------------+-----------------------------
 Reporter:  justinbusa    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  4.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39273>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list