Skip to content

Commit a9f14af

Browse files
committed
Follow-up grapheme_strrev
1 parent 7a1c261 commit a9f14af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/intl/grapheme/grapheme_string.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,13 +1181,17 @@ U_CFUNC PHP_FUNCTION(grapheme_strrev)
11811181
current = ZSTR_LEN(string);
11821182
for (end = pstr; pos != UBRK_DONE; ) {
11831183
pos = ubrk_previous(bi);
1184+
if (pos == UBRK_DONE) {
1185+
break;
1186+
}
11841187
end_len = current - pos;
11851188
for (int32_t j = 0; j < end_len; j++) {
11861189
*p++ = *(pstr + pos + j);
11871190
}
11881191
current = pos;
11891192
}
11901193
ubrk_end:
1194+
*p = '\0';
11911195
RETVAL_NEW_STR(ret);
11921196
ubrk_close(bi);
11931197
close:

0 commit comments

Comments
 (0)