Skip to content

Commit 5a51da9

Browse files
committed
Use inlined version of zval_ptr_dtor() in array_map() loop
1 parent e111bcc commit 5a51da9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ext/standard/array.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6024,6 +6024,7 @@ PHP_FUNCTION(array_map)
60246024
zend_ulong num_key;
60256025
zend_string *str_key;
60266026
zval *zv, arg;
6027+
int ret;
60276028

60286029
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
60296030
php_error_docref(NULL, E_WARNING, "Argument #%d should be an array", 2);
@@ -6046,13 +6047,11 @@ PHP_FUNCTION(array_map)
60466047
fci.no_separation = 0;
60476048

60486049
ZVAL_COPY(&arg, zv);
6049-
6050-
if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
6051-
zval_dtor(return_value);
6052-
zval_ptr_dtor(&arg);
6050+
ret = zend_call_function(&fci, &fci_cache);
6051+
i_zval_ptr_dtor(&arg ZEND_FILE_LINE_CC);
6052+
if (ret != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
6053+
zend_array_destroy(Z_ARR_P(return_value));
60536054
RETURN_NULL();
6054-
} else {
6055-
zval_ptr_dtor(&arg);
60566055
}
60576056
if (str_key) {
60586057
zend_hash_add_new(Z_ARRVAL_P(return_value), str_key, &result);
@@ -6136,7 +6135,7 @@ PHP_FUNCTION(array_map)
61366135

61376136
if (zend_call_function(&fci, &fci_cache) != SUCCESS || Z_TYPE(result) == IS_UNDEF) {
61386137
efree(array_pos);
6139-
zval_dtor(return_value);
6138+
zend_array_destroy(Z_ARR_P(return_value));
61406139
for (i = 0; i < n_arrays; i++) {
61416140
zval_ptr_dtor(&params[i]);
61426141
}

0 commit comments

Comments
 (0)