Emoji: Allow emoji in blogname and blogdescription on utf8 installs.

When the options table is set to `utf8` instead of `utf8mb4`, emoji will be stripped from the blog name and description when they're saved. Instead of stripping them, they can be encode as HTML entities.

Fixes #36122.



git-svn-id: https://develop.svn.wordpress.org/trunk@37469 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2016-05-20 04:53:40 +00:00
parent 898f42c2a6
commit 6d963d60c6
2 changed files with 21 additions and 0 deletions

View File

@@ -102,4 +102,21 @@ class Tests_Sanitize_Option extends WP_UnitTestCase {
$this->assertSame( $expected, sanitize_option( 'upload_path', $provided ) );
}
/**
* @ticket #36122
*/
public function test_emoji_in_blogname_and_description() {
global $wpdb;
$value = "whee\xf0\x9f\x98\x88";
if ( 'utf8mb4' === $wpdb->get_col_charset( $wpdb->options, 'option_value' ) ) {
$expected = $value;
} else {
$expected = 'whee😈';
}
$this->assertSame( $expected, sanitize_option( 'blogname', $value ) );
$this->assertSame( $expected, sanitize_option( 'blogdescription', $value ) );
}
}