diff options
author | Xinchen Hui <laruence@gmail.com> | 2018-07-24 11:37:09 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2018-07-24 11:37:09 +0800 |
commit | 3ca9aaf24e4f61ce77439ce1ddf74f8b26db629b (patch) | |
tree | b46c956c799511e78cab0f5ef995f718dc4bf5fd /ext/standard/tests/array | |
parent | 4799cde613a131c312793d194414e3b3b015877a (diff) | |
parent | 033dac7a6f6ac323fb35eb2c26cd716c610e18cf (diff) | |
download | php-git-3ca9aaf24e4f61ce77439ce1ddf74f8b26db629b.tar.gz |
Merge branch 'PHP-7.2'
* PHP-7.2:
Update NEWs
Fixed bug #68553 (array_column: null values in $index_key become incrementing keys in result)
Conflicts:
ext/standard/array.c
Diffstat (limited to 'ext/standard/tests/array')
-rw-r--r-- | ext/standard/tests/array/bug68553.phpt | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ext/standard/tests/array/bug68553.phpt b/ext/standard/tests/array/bug68553.phpt new file mode 100644 index 0000000000..91c5b080a9 --- /dev/null +++ b/ext/standard/tests/array/bug68553.phpt @@ -0,0 +1,66 @@ +--TEST-- +Bug #68553 (array_column: null values in $index_key become incrementing keys in result) +--FILE-- +<?php +$i = 100; +/* increase the resource id to make test stable */ +while ($i--) { + $fd = fopen(__FILE__, "r"); + fclose($fd); +} +$a = [ + ['a' => 10], + ['a' => 20], + ['a' => true], + ['a' => false], + ['a' => fopen(__FILE__, "r")], + ['a' => -5], + ['a' => 7.38], + ['a' => null, "test"], + ['a' => null], +]; + +var_dump(array_column($a, null, 'a')); +--EXPECTF-- +array(8) { + [10]=> + array(1) { + ["a"]=> + int(10) + } + [20]=> + array(1) { + ["a"]=> + int(20) + } + [1]=> + array(1) { + ["a"]=> + bool(true) + } + [0]=> + array(1) { + ["a"]=> + bool(false) + } + [%d]=> + array(1) { + ["a"]=> + resource(%d) of type (stream) + } + [-5]=> + array(1) { + ["a"]=> + int(-5) + } + [7]=> + array(1) { + ["a"]=> + float(7.38) + } + [""]=> + array(1) { + ["a"]=> + NULL + } +} |