We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d28d59a commit 465ecaaCopy full SHA for 465ecaa
1 file changed
ext/standard/string.c
@@ -2203,10 +2203,10 @@ PHP_FUNCTION(chunk_split)
2203
2204
if ((size_t)chunklen > ZSTR_LEN(str)) {
2205
/* to maintain BC, we must return original string + ending */
2206
- result = zend_string_safe_alloc(ZSTR_LEN(str), 1, endlen, 0);
2207
- memcpy(ZSTR_VAL(result), ZSTR_VAL(str), ZSTR_LEN(str));
2208
- memcpy(ZSTR_VAL(result) + ZSTR_LEN(str), end, endlen);
2209
- ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
+ result = zend_string_concat2(
+ ZSTR_VAL(str), ZSTR_LEN(str),
+ end, endlen
+ );
2210
RETURN_NEW_STR(result);
2211
}
2212
0 commit comments