We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ccbfb47 commit 2683c5bCopy full SHA for 2683c5b
1 file changed
ext/intl/grapheme/grapheme_string.cpp
@@ -1176,14 +1176,15 @@ U_CFUNC PHP_FUNCTION(grapheme_limit_codepoints)
1176
RETURN_FALSE;
1177
}
1178
1179
- zend_ulong pos, before;
+ zend_ulong pos, before, pos_codepoint;
1180
zend_bool ret = true;
1181
for (before = pos = 0; pos != UBRK_DONE; ) {
1182
pos = ubrk_next(bi);
1183
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) {
+ pos_codepoint = pos - before;
+ for (zend_ulong i = before, codepoint = 0; i < pos_codepoint; i++, codepoint++) {
+ U8_FWD_1(string, before, pos_codepoint - i);
1187
+ if (codepoint >= limit_codepoint) {
1188
ret = false;
1189
goto bi_close;
1190
0 commit comments