summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/array.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index ab34ac4a28..d6ea5c481b 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -6024,6 +6024,7 @@ PHP_FUNCTION(array_map)
zend_ulong num_key;
zend_string *str_key;
zval *zv, arg;
+ int ret;
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
php_error_docref(NULL, E_WARNING, "Argument #%d should be an array", 2);
@@ -6046,13 +6047,11 @@ PHP_FUNCTION(array_map)
fci.no_separation = 0;
ZVAL_COPY(&arg, zv);
-
- if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
- zval_dtor(return_value);
- zval_ptr_dtor(&arg);
+ ret = zend_call_function(&fci, &fci_cache);
+ i_zval_ptr_dtor(&arg ZEND_FILE_LINE_CC);
+ if (ret != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_NULL();
- } else {
- zval_ptr_dtor(&arg);
}
if (str_key) {
zend_hash_add_new(Z_ARRVAL_P(return_value), str_key, &result);
@@ -6136,7 +6135,7 @@ PHP_FUNCTION(array_map)
if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
efree(array_pos);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
for (i = 0; i < n_arrays; i++) {
zval_ptr_dtor(&params[i]);
}