diff --git a/ext/standard/array.c b/ext/standard/array.c index 7c4caafa5a6..d6d66dbc497 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4049,7 +4049,8 @@ PHP_FUNCTION(array_values) /* Return empty input as is */ arrlen = zend_hash_num_elements(arrval); if (!arrlen) { - RETURN_ZVAL(input, 1, 0); + ZVAL_EMPTY_ARRAY(return_value); + return; } /* Return vector-like packed arrays as-is */ diff --git a/ext/standard/tests/array/bug75653.phpt b/ext/standard/tests/array/bug75653.phpt new file mode 100644 index 00000000000..d11c1e0c755 --- /dev/null +++ b/ext/standard/tests/array/bug75653.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #75653: array_values don't work on empty array +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(5) "data2" + [1]=> + string(5) "data3" +}