Skip to content

Commit 782eefd

Browse files
committed
Use zend_array_to_list() in PHP_FUNCTION(array_values)
1 parent e5c6ed1 commit 782eefd

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

ext/standard/array.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4147,8 +4147,7 @@ PHP_FUNCTION(array_key_last)
41474147
/* {{{ Return just the values from the input array */
41484148
PHP_FUNCTION(array_values)
41494149
{
4150-
zval *input, /* Input array */
4151-
*entry; /* An entry in the input array */
4150+
zval *input; /* Input array */
41524151
zend_array *arrval;
41534152
zend_long arrlen;
41544153

@@ -4170,20 +4169,7 @@ PHP_FUNCTION(array_values)
41704169
RETURN_COPY(input);
41714170
}
41724171

4173-
/* Initialize return array */
4174-
array_init_size(return_value, arrlen);
4175-
zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
4176-
4177-
/* Go through input array and add values to the return array */
4178-
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
4179-
ZEND_HASH_FOREACH_VAL(arrval, entry) {
4180-
if (UNEXPECTED(Z_ISREF_P(entry) && Z_REFCOUNT_P(entry) == 1)) {
4181-
entry = Z_REFVAL_P(entry);
4182-
}
4183-
Z_TRY_ADDREF_P(entry);
4184-
ZEND_HASH_FILL_ADD(entry);
4185-
} ZEND_HASH_FOREACH_END();
4186-
} ZEND_HASH_FILL_END();
4172+
RETVAL_ARR(zend_array_to_list(arrval));
41874173
}
41884174
/* }}} */
41894175

0 commit comments

Comments
 (0)