[wp-trac] [WordPress Trac] #37956: DB_COLLATE doesn't override $collate when defining utf8mb4_unicode_ci in wp-config

WordPress Trac noreply at wordpress.org
Thu Sep 29 17:34:19 UTC 2016


#37956: DB_COLLATE doesn't override $collate when defining utf8mb4_unicode_ci in
wp-config
--------------------------+----------------------
 Reporter:  MikeGillihan  |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Database      |     Version:  4.6
 Severity:  normal        |  Resolution:  wontfix
 Keywords:                |     Focuses:
--------------------------+----------------------

Comment (by MikeGillihan):

 Replying to [comment:1 pento]:
 > This behaviour is on purpose - if `DB_COLLATE` is defined as
 `utf8mb4_unicode_ci`, but the server supports `utf8mb4_unicode_520_ci`,
 it's better to use the latter, in much the same way as setting
 `DB_CHARSET` to `utf8` will be automatically upgraded to `utf8mb4` when
 possible.

 Sorry, I missed your response @pento. Thanks for being so speedy!

 I understand the behavior is intended and I agree that 520 is better. My
 point was more about the fact that the core file overrides the global
 constant defined in wp-config.php.

 It's a bit abstract, but if I incorrectly define DB_NAME, the constant is
 respected and it breaks the install. Why then, do we not respect the
 DB_COLLATE constant?

 @discern While it could achieve the desired result, it feels a bit heavy.
 The patch I provided just adds a conditional wrapper that fully respects
 the constant.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37956#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list