Skip to content

Commit 2683c5b

Browse files
committed
Fix unsequenced
1 parent ccbfb47 commit 2683c5b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/intl/grapheme/grapheme_string.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,14 +1176,15 @@ U_CFUNC PHP_FUNCTION(grapheme_limit_codepoints)
11761176
RETURN_FALSE;
11771177
}
11781178

1179-
zend_ulong pos, before;
1179+
zend_ulong pos, before, pos_codepoint;
11801180
zend_bool ret = true;
11811181
for (before = pos = 0; pos != UBRK_DONE; ) {
11821182
pos = ubrk_next(bi);
11831183
if (pos != UBRK_DONE) {
1184-
for (zend_ulong i = before; i < (pos - before); i++) {
1185-
U8_FWD_1(string, before, (pos - before) - i);
1186-
if (i >= limit_codepoint) {
1184+
pos_codepoint = pos - before;
1185+
for (zend_ulong i = before, codepoint = 0; i < pos_codepoint; i++, codepoint++) {
1186+
U8_FWD_1(string, before, pos_codepoint - i);
1187+
if (codepoint >= limit_codepoint) {
11871188
ret = false;
11881189
goto bi_close;
11891190
}

0 commit comments

Comments
 (0)