Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -5986,15 +5986,15 @@ PHP_FUNCTION(array_reduce)
ZVAL_COPY(&args[1], operand);
fci.params = args;

zval_ptr_dtor(&result);

if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both if and else branches have these zval_ptr_dtor(&args[1]); and zval_ptr_dtor(&args[0]); lines. Can't we move out of the check to avoid duplication?

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();
Expand Down