xref: /PHP-8.1/ext/spl/tests/bug62978.phpt (revision 7aacc705)
1--TEST--
2Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables)
3--FILE--
4<?php
5$a = new ArrayObject();
6
7$b = array();
8
9$a[null]['hurr'] = 'durr';
10
11var_dump($a['epic_magic']);
12var_dump($b['epic_magic']);
13var_dump($c['epic_magic']); // Undefined var!!
14
15$d = array();
16var_dump($a['epic_magic']); // more magic!
17var_dump($d['epic_magic']);
18
19$e = 'srsly?';
20var_dump($a['epic_magic']); // srsly.
21var_dump(isset($a['epic_magic']));
22
23$fp = fopen(__FILE__, 'r');
24var_dump($a[$fp]);
25
26fclose($fp);
27?>
28--EXPECTF--
29Warning: Undefined array key "epic_magic" in %s on line %d
30NULL
31
32Warning: Undefined array key "epic_magic" in %s on line %d
33NULL
34
35Warning: Undefined variable $c in %s on line %d
36
37Warning: Trying to access array offset on value of type null in %s on line %d
38NULL
39
40Warning: Undefined array key "epic_magic" in %s on line %d
41NULL
42
43Warning: Undefined array key "epic_magic" in %s on line %d
44NULL
45
46Warning: Undefined array key "epic_magic" in %s on line %d
47NULL
48bool(false)
49
50Warning: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d
51
52Warning: Undefined array key 5 in %s on line %d
53NULL
54