Commit 8d7699dc503 for php

commit 8d7699dc503b7600a52461079cbd9e376ee8913c
Merge: 4c4e4b747f4 6d122e33ae5
Author: David Carlier <devnexen@gmail.com>
Date:   Sun Dec 6 03:36:46 2026 +0000

    Merge branch 'PHP-8.6'

    * PHP-8.6:
      ext/intl: Fix grapheme searches with an offset inside a contraction

diff --cc ext/intl/grapheme/grapheme_util.cpp
index bf4be3f6380,a3509fc352c..9e1b3cf2635
--- a/ext/intl/grapheme/grapheme_util.cpp
+++ b/ext/intl/grapheme/grapheme_util.cpp
@@@ -98,9 -101,29 +98,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*/
 -U_CFUNC 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)
 +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;