xref: /PHP-7.1/ext/spl/tests/bug62978.phpt (revision 8d003858)
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--EXPECTF--
28Notice: Undefined index: epic_magic in %sbug62978.php on line %d
29NULL
30
31Notice: Undefined index: epic_magic in %sbug62978.php on line %d
32NULL
33
34Notice: Undefined variable: c in %sbug62978.php on line %d
35NULL
36
37Notice: Undefined index: epic_magic in %sbug62978.php on line %d
38NULL
39
40Notice: Undefined index: epic_magic in %sbug62978.php on line %d
41NULL
42
43Notice: Undefined index: epic_magic in %sbug62978.php on line %d
44NULL
45bool(false)
46
47Notice: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d
48
49Notice: Undefined offset: %d in %sbug62978.php on line %d
50NULL
51