[wp-trac] [WordPress Trac] #59868: Database insert with emoji fails when table has columns with both utf8mb3 (utf8) and utf8mb4 charsets
WordPress Trac
noreply at wordpress.org
Sun Jan 19 10:10:48 UTC 2025
#59868: Database insert with emoji fails when table has columns with both utf8mb3
(utf8) and utf8mb4 charsets
--------------------------------------+-----------------------------
Reporter: ianmjones | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Charset | Version: 4.2
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Comment (by jondaley):
I think the code has been written and a PR generated, but not merged into
the core yet? Is this waiting for someone? I see the PR was checked by a
few people.
My customer complained that my fix stopped working.
I currently have the following in post.php. I'll do some debugging to see
if I can figure out what has changed.
{{{#!php
foreach ( $emoji_fields as $emoji_field ) {
if ( isset( $data[ $emoji_field ] ) ) {
$charset = $wpdb->get_col_charset( $wpdb->posts,
$emoji_field );
// TSL mod: https://core.trac.wordpress.org/ticket/59868
if ( strpos($charset, 'utf8') !== FALSE ) {
$data[ $emoji_field ] = wp_encode_emoji(
$data[ $emoji_field ] );
}
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59868#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list