Skip to content

Commit ab6c45f

Browse files
crhgnikic
authored andcommitted
Fix bug #75533: array_reduce is slow when $carry is large array
1 parent be02b2e commit ab6c45f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ PHP NEWS
2222
data connection). (Ville Hukkamäki)
2323
. Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with
2424
stream_socket_client). (Ville Hukkamäki)
25+
. Fixed bug #75533 (array_reduce is slow when $carry is large array).
26+
(Manabu Matsui)
2527

2628
- Zlib:
2729
. Fixed bug #75273 (php_zlib_inflate_filter() may not update bytes_consumed).

ext/standard/array.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5231,19 +5231,17 @@ PHP_FUNCTION(array_reduce)
52315231
fci.no_separation = 0;
52325232

52335233
ZEND_HASH_FOREACH_VAL(htbl, operand) {
5234-
ZVAL_COPY(&args[0], &result);
5234+
ZVAL_COPY_VALUE(&args[0], &result);
52355235
ZVAL_COPY(&args[1], operand);
52365236
fci.params = args;
52375237

52385238
if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
52395239
zval_ptr_dtor(&args[1]);
52405240
zval_ptr_dtor(&args[0]);
5241-
zval_ptr_dtor(&result);
52425241
ZVAL_COPY_VALUE(&result, &retval);
52435242
} else {
52445243
zval_ptr_dtor(&args[1]);
52455244
zval_ptr_dtor(&args[0]);
5246-
zval_ptr_dtor(&result);
52475245
return;
52485246
}
52495247
} ZEND_HASH_FOREACH_END();

0 commit comments

Comments
 (0)