Commit 31014f24d42 for php
commit 31014f24d421e9518e3dc61b8e008169c4bf5853
Merge: 5900afb5a3c 564e9567e8c
Author: David Carlier <devnexen@gmail.com>
Date: Sun Dec 6 03:36:38 2026 +0000
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/intl: Fix grapheme searches with an offset inside a contraction
diff --cc ext/intl/grapheme/grapheme_util.c
index e86e65c55f4,e74e46c2692..1404806e093
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
@@@ -92,9 -92,29 +92,29 @@@ void grapheme_substr_ascii(char *str, s
goto finish; \
}
+ /* Find the next match that starts at or after "from". When "from" falls inside
+ * a contraction, such as a Thai prevowel and its consonant, ICU returns the match
+ * that starts at the contraction, before "from". Search again from each following
+ * grapheme boundary, so that a match overlapping the skipped one is not missed. */
+ static int32_t grapheme_usearch_next_from(UStringSearch *src, UBreakIterator *bi, int32_t from, UErrorCode *status)
+ {
+ int32_t pos = usearch_next(src, status);
+ int32_t boundary = from;
+
+ while (U_SUCCESS(*status) && pos != USEARCH_DONE && pos < from) {
+ boundary = ubrk_following(bi, boundary);
+ if (boundary == UBRK_DONE) {
+ return USEARCH_DONE;
+ }
+ usearch_setOffset(src, boundary, status);
+ pos = usearch_next(src, status);
+ }
+
+ return pos;
+ }
/* {{{ grapheme_strpos_utf16 - strrpos using utf16*/
-int32_t grapheme_strpos_utf16(char *haystack, size_t haystack_len, char *needle, size_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last)
+int32_t grapheme_strpos_utf16(char *haystack, size_t haystack_len, char *needle, size_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last, const char* locale)
{
UChar *uhaystack = NULL, *uneedle = NULL;
int32_t uhaystack_len = 0, uneedle_len = 0, char_pos, ret_pos, offset_pos = 0;