[wp-trac] [WordPress Trac] #35293: Emoji Regex in wp_encode_emoji() is wildly inaccurate

WordPress Trac noreply at wordpress.org
Wed Jul 12 11:28:14 UTC 2017


#35293: Emoji Regex in wp_encode_emoji() is wildly inaccurate
-------------------------------------------------+-------------------------
 Reporter:  pento                                |       Owner:  pento
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  4.8.1
Component:  Emoji                                |     Version:  4.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by pento):

 * keywords:   => has-patch needs-testing needs-unit-tests
 * milestone:  Future Release => 4.8.1


Comment:

 [attachment:35293.3.diff] Works!

 A few things to note:
 - The fallback regex that `wp_emoji_regex()` returns is wrong, since it
 now matches entire emoji, instead of individual bytes making up an emoji.
 - The regex that the Gruntfile task generates can probably be optimised a
 bit - it really only needs to unravel surrogate pair code points
 (\ud800-\udfff), rather than every code point.
 - Needs unit tests. So. Many. Unit Tests.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35293#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list