Make WordPress Core


Ignore:
Timestamp:
05/20/2016 04:53:40 AM (10 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/option/sanitize-option.php

    r34519 r37469  
    103103        }
    104104
     105        /**
     106         * @ticket #36122
     107         */
     108        public function test_emoji_in_blogname_and_description() {
     109                global $wpdb;
     110
     111                $value = "whee\xf0\x9f\x98\x88";
     112
     113                if ( 'utf8mb4' === $wpdb->get_col_charset( $wpdb->options, 'option_value' ) ) {
     114                        $expected = $value;
     115                } else {
     116                        $expected = 'whee😈';
     117                }
     118
     119                $this->assertSame( $expected, sanitize_option( 'blogname', $value ) );
     120                $this->assertSame( $expected, sanitize_option( 'blogdescription', $value ) );
     121        }
    105122}
Note: See TracChangeset for help on using the changeset viewer.