summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManabu Matsui <manabu.matsui@gmail.com>2017-11-22 11:07:15 +0900
committerNikita Popov <nikita.ppv@gmail.com>2018-09-18 20:49:59 +0200
commitab6c45f5249d077463c1876d7cf09a11f04240fa (patch)
treee3dd06317448af05f11c9bfc7125839975ba028a
parentbe02b2e8fd47ca3410ca6046b45f38fcc0e9333b (diff)
downloadphp-git-ab6c45f5249d077463c1876d7cf09a11f04240fa.tar.gz
Fix bug #75533: array_reduce is slow when $carry is large array
-rw-r--r--NEWS2
-rw-r--r--ext/standard/array.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index a7e900145b..0e5daeacd6 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,8 @@ PHP NEWS
data connection). (Ville Hukkamäki)
. Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with
stream_socket_client). (Ville Hukkamäki)
+ . Fixed bug #75533 (array_reduce is slow when $carry is large array).
+ (Manabu Matsui)
- Zlib:
. Fixed bug #75273 (php_zlib_inflate_filter() may not update bytes_consumed).
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 4ba286e70e..15df3b9359 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -5231,19 +5231,17 @@ PHP_FUNCTION(array_reduce)
fci.no_separation = 0;
ZEND_HASH_FOREACH_VAL(htbl, operand) {
- ZVAL_COPY(&args[0], &result);
+ ZVAL_COPY_VALUE(&args[0], &result);
ZVAL_COPY(&args[1], operand);
fci.params = args;
if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&result);
ZVAL_COPY_VALUE(&result, &retval);
} else {
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&result);
return;
}
} ZEND_HASH_FOREACH_END();