Skip to content

Commit dbab14a

Browse files
committed
Emoji: Convert emoji to HTML entities for utf8mb3 columns during wp_insert_post().
The `utf8` character set is a deprecated alias of `utf8mb3`, but only the former was accounted for. Follow-up to [31733]. Props kasparsd, mikefitzman, dmsnell, salzano, sabernhardt, ankit-k-gupta, nataliat2004, josklever, slaFFik, staurand. See #31242, #21212. Fixes #60362. git-svn-id: https://develop.svn.wordpress.org/trunk@61110 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 13fe697 commit dbab14a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wp-includes/post.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4842,7 +4842,8 @@ function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true )
48424842
if ( isset( $data[ $emoji_field ] ) ) {
48434843
$charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field );
48444844

4845-
if ( 'utf8' === $charset ) {
4845+
// The 'utf8' character set is a deprecated alias of 'utf8mb3'. See <https://dev.mysql.com/doc/refman/8.4/en/charset-unicode-utf8.html>.
4846+
if ( 'utf8' === $charset || 'utf8mb3' === $charset ) {
48464847
$data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] );
48474848
}
48484849
}

0 commit comments

Comments
 (0)