Skip to content

grapheme\slice returns unexpected result for emojis #9301

Open
@blurrcat

Description

Describe the bug
grapheme\slice returns unexpected result for emojis

Standalone code, or other way to reproduce the problem

Steps to reproduce the behavior:

  1. Open repl hhvm -a
  2. run echo \grapheme_substr('💪💪💪', 0, 1)

Expected behavior

should return one emoji:

hphpd> echo \grapheme_substr('💪💪💪', 0, 1)
💪

Actual behavior
returns 2 emojis:

hphpd> echo \grapheme_substr('💪💪💪', 0, 1)
💪💪

Environment

  • Operating system: Ubuntu 18.04
  • Installation method: docker
  • HHVM Version
> hhvm --version
HipHop VM 4.153.1 (rel) (non-lowptr)
Compiler: remotes/origin/4.153.1-slack-0-g0d6665670e7cfe81a1e0073009a242b55427e1aa
Repo schema: 02e77cd368c8eee9d671aa04701f100de041e020

> hh_client --version
hackc-af371b47fe0b21e407dd864cda303511763bb7c1-4.153.1

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions