[wp-trac] [WordPress Trac] #46947: ‘❤’ in Comment Generates DB Error

WordPress Trac noreply at wordpress.org
Wed Oct 29 09:14:09 UTC 2025


#46947: ‘❤’ in Comment Generates DB Error
-------------------------------------------------+-------------------------
 Reporter:  HisKingdomProphecy                   |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:
Component:  Database                             |     Version:  5.1.1
 Severity:  normal                               |  Resolution:  duplicate
 Keywords:  needs-testing needs-patch reporter-  |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by kasparsd):

 @westonruter It seems that this issue is caused by the DB tables/columns
 using `utf8mb4_unicode_ci` charset (does support 4-byte chars) while the
 `DB_CHARSET` constant is set to `utf8` (now called `utf8mb3`) which
 doesn't support 4-byte characters. The constant should be updated to
 either default empty string `''` or to the correct collation.

 During `wp_new_comment()` WP runs `$wpdb->strip_invalid_text_for_column()`
 instead of the emoji-to-htmlentities mapper, which should remove all
 multibyte chars if the column reports lack of mb4 support.

 It could also be that the collations of the different tables used in the
 DB query are different and are causing the `Illegal mix of collations
 (...,IMPLICIT) and (..,COERCIBLE) for operation ‘=’` error (a
 configuration issue).

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


More information about the wp-trac mailing list