-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PHP 8.4][Intl] Add grapheme_str_split
#483
base: 1.x
Are you sure you want to change the base?
Conversation
(working on the Intl changes, I'll mark the PR ready then) |
Thank you. I think, we should add this polyfill to the intl-grapheme polyfill as well. |
75b1867
to
123cf13
Compare
Thank you @derrabus - I added polyfill and tests for |
Friendly ping @Ayesh :) |
0d90a13
to
7a429f5
Compare
Thank you @nicolas-grekas - really helpful comments, I addressed them and force-pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question + minor CS things and GTM
7a429f5
to
bf4a1a7
Compare
One last push, thank you for being patient with this 💜 |
So we have a test failure on PHP 7.2 :) |
84bcd48
to
cf9281b
Compare
Perfect, fixed. |
Add a polyfill for the `grapheme_str_split` function added in PHP 8.4. Requires PHP 7.3, because the polyfill is based on `\X` Regex, and it only works properly on PCRE2, which [only comes with PHP 7.3+](https://php.watch/versions/7.3/pcre2). Further, there are some cases that the polyfill cannot split complex characters (such as two consecutive country flag Emojis). This is now fixed in [PCRE2Project/pcre2#410](PCRE2Project/pcre2#410). However, this change will likely only make it to PHP 8.4. References: - [RFC: Grapheme cluster for `str_split` function: `grapheme_str_split`](https://wiki.php.net/rfc/grapheme_str_split) - [PHP.Watch: PHP 8.4: New `grapheme_str_split` function](https://php.watch/versions/8.4/grapheme_str_split)
cf9281b
to
4a7aa31
Compare
Adds a polyfill for the
grapheme_str_split
function added in PHP 8.4.Requires PHP 7.3, because the polyfill is based on
\X
Regex, and it only works properly on PCRE2, which only comes with PHP 7.3+.Further, there are some cases that the polyfill cannot split complex characters (such as two consecutive country flag Emojis). This is now fixed in PCRE2Project/pcre2#410. However, this change will likely only make it to PHP 8.4.
References:
str_split
function:grapheme_str_split
grapheme_str_split
function (polyfill source)