Commit ac53f14223b for php.net
commit ac53f14223b4cda3199675878113f82de4d1717a
Author: Weilin Du <weilindu@php.net>
Date: Fri Sep 11 00:03:56 2026 +0800
ext/standard: Use ZVAL_STRINGL_FAST() in php_explode_negative_limit() (#23631)
Ideally this save a emalloc + memcpy + free.
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 2d868513e4a..04c3c21b286 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -921,7 +921,7 @@ PHPAPI void php_explode_negative_limit(const zend_string *delim, zend_string *st
to_return = limit + found;
/* limit is at least -1 therefore no need of bounds checking : i will be always less than found */
for (i = 0; i < to_return; i++) { /* this checks also for to_return > 0 */
- ZVAL_STRINGL(&tmp, positions[i], (positions[i+1] - ZSTR_LEN(delim)) - positions[i]);
+ ZVAL_STRINGL_FAST(&tmp, positions[i], (positions[i+1] - ZSTR_LEN(delim)) - positions[i]);
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
}
efree((void *)positions);