xref: /PHP-7.4/ext/standard/tests/array/bug70668.phpt (revision 3815e971)
1--TEST--
2Bug #70668 (array_keys() doesn't respect references when $strict is true)
3--FILE--
4<?php
5$arr = array(1, "1", "", NULL, 0, false, true, array());
6
7$s = &$arr[0];
8var_dump(array_keys($arr, $s, true));
9
10$s = &$arr[1];
11var_dump(array_keys($arr, $s, true));
12
13$s = &$arr[2];
14var_dump(array_keys($arr, $s, true));
15
16$s = &$arr[3];
17var_dump(array_keys($arr, $s, true));
18
19$s = &$arr[4];
20var_dump(array_keys($arr, $s, true));
21
22$s = &$arr[5];
23var_dump(array_keys($arr, $s, true));
24
25$s = &$arr[6];
26var_dump(array_keys($arr, $s, true));
27
28$s = &$arr[7];
29var_dump(array_keys($arr, $s, true));
30?>
31--EXPECT--
32array(1) {
33  [0]=>
34  int(0)
35}
36array(1) {
37  [0]=>
38  int(1)
39}
40array(1) {
41  [0]=>
42  int(2)
43}
44array(1) {
45  [0]=>
46  int(3)
47}
48array(1) {
49  [0]=>
50  int(4)
51}
52array(1) {
53  [0]=>
54  int(5)
55}
56array(1) {
57  [0]=>
58  int(6)
59}
60array(1) {
61  [0]=>
62  int(7)
63}
64