facebook / facebook/hhvm

`grapheme\slice` returns unexpected result for emojis

Open
#9,301 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.