[php-src] PR #23519: [intl] Fix empty-needle grapheme_strpos offsets

From: Date: Mon, 31 Aug 2026 10:57:27 +0000
Subject: [php-src] PR #23519: [intl] Fix empty-needle grapheme_strpos offsets
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38229@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23519 Author: iliaal grapheme_strpos() and grapheme_strrpos() with an empty needle return the raw UTF-16 code-unit position instead of a grapheme index, so on a haystack containing a non-BMP or combining grapheme the reported offset is too large: grapheme_strpos("😀x", "", 1) gives 3 where 1 is correct. The empty-needle early return in grapheme_strpos_utf16() skips the grapheme_count_graphemes() conversion that the non-empty search already does. grapheme_strstr() is unaffected: it consumes the separate raw UTF-16 out-parameter, not the return value.

« previous php.git-pulls (#38229) next »