Merge branch 'PHP-7.2'

This commit is contained in:
Nikita Popov 2018-01-12 18:30:34 +01:00
commit 5c983ae852
2 changed files with 22 additions and 1 deletions

View File

@ -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 */

View File

@ -0,0 +1,20 @@
--TEST--
Bug #75653: array_values don't work on empty array
--FILE--
<?php
$array[] = 'data1';
unset($array[0]);
$array = array_values($array);
$array[] = 'data2';
$array[] = 'data3';
var_dump($array);
?>
--EXPECT--
array(2) {
[0]=>
string(5) "data2"
[1]=>
string(5) "data3"
}