Skip to content

Allow empty needle in grapheme_str*() functions #20

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

Closed
kocsismate opened this issue Sep 7, 2020 · 2 comments
Closed

Allow empty needle in grapheme_str*() functions #20

kocsismate opened this issue Sep 7, 2020 · 2 comments

Comments

@kocsismate
Copy link
Member

Currently, string functions in ext/standard and ext/mbstring can accept an empty $needle, so we should add support for this in ext/intl as well.

The relevant code that needs to be changed is https://github.com/unicode-org/icu/blob/f744742e036441cbfd54b535e722dc3801ff0f63/icu4c/source/i18n/usearch.cpp#L2675. Discussion: php/php-src#5972 (comment)

@chschneider
Copy link

I made a patch to allow empty needles by explicitly checking in grapheme_strpos_utf16.

See
php/php-src@master...chschneider:grapheme_empty_needles
for the diff, should I submit a pull request or are there major issues with this approach?

@nikic
Copy link
Member

nikic commented Sep 30, 2020

@chschneider Looks reasonable

php-pulls pushed a commit to php/php-src that referenced this issue Oct 1, 2020
For consistency with str* and mb_str* functions.

Closes GH-6245.
Closes php/php-tasks#20.
@nikic nikic closed this as completed Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants