diff --git a/tests/test-class-wp-web-app-manifest.php b/tests/test-class-wp-web-app-manifest.php index 6575f5bf4..473e0fd16 100644 --- a/tests/test-class-wp-web-app-manifest.php +++ b/tests/test-class-wp-web-app-manifest.php @@ -581,6 +581,8 @@ public function get_data_to_test_sanitize_short_name() { 'whitespace_padding' => array( ' WP Dev ', 'WP Dev' ), 'script_contains' => array( 'WP Dev ', 'WP Dev' ), 'too_long' => array( 'WordPress Develop', 'WordPress De' ), + 'multi-byte' => array( 'On the RhΓ΄ne', 'On the RhΓ΄ne' ), + 'emoji' => array( 'πŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘Œ', 'πŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘ŒπŸ‘Œ' ), // πŸ‘Œ takes 4 bytes. ); } diff --git a/wp-includes/class-wp-web-app-manifest.php b/wp-includes/class-wp-web-app-manifest.php index c3045e737..3acb5c078 100644 --- a/wp-includes/class-wp-web-app-manifest.php +++ b/wp-includes/class-wp-web-app-manifest.php @@ -575,7 +575,7 @@ public function sanitize_short_name( $value ) { return ''; } $value = trim( sanitize_text_field( $value ) ); - return (string) substr( $value, 0, self::SHORT_NAME_MAX_LENGTH ); + return (string) mb_substr( $value, 0, self::SHORT_NAME_MAX_LENGTH ); } /**