Emoji: Fix incorrect emoji encoding in PHP < 5.4.
[41701] included a bug with PHP < 5.4. Prior to then, `html_entity_decode()` decoded into `ISO-8859-1`, when we actually need it to use `UTF-8`. Fixes #35293. Built from https://develop.svn.wordpress.org/trunk@41702 git-svn-id: http://core.svn.wordpress.org/trunk@41536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a7a57df525
commit
369ad06c82
|
@ -5113,7 +5113,11 @@ function wp_encode_emoji( $content ) {
|
|||
$emoji = _wp_emoji_list( 'partials' );
|
||||
|
||||
foreach ( $emoji as $emojum ) {
|
||||
if ( version_compare( phpversion(), '5.4', '<' ) ) {
|
||||
$emoji_char = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' );
|
||||
} else {
|
||||
$emoji_char = html_entity_decode( $emojum );
|
||||
}
|
||||
if ( false !== strpos( $content, $emoji_char ) ) {
|
||||
$content = preg_replace( "/$emoji_char/", $emojum, $content );
|
||||
}
|
||||
|
@ -5151,9 +5155,13 @@ function wp_staticize_emoji( $text ) {
|
|||
$possible_emoji = array();
|
||||
foreach( $emoji as $emojum ) {
|
||||
if ( false !== strpos( $text, $emojum ) ) {
|
||||
if ( version_compare( phpversion(), '5.4', '<' ) ) {
|
||||
$possible_emoji[ $emojum ] = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' );
|
||||
} else {
|
||||
$possible_emoji[ $emojum ] = html_entity_decode( $emojum );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $possible_emoji ) {
|
||||
return $text;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-alpha-41701';
|
||||
$wp_version = '4.9-alpha-41702';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue