File: bug62978.phpt

package info (click to toggle)
php8.4 8.4.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 211,276 kB
  • sloc: ansic: 1,176,142; php: 35,419; sh: 11,964; cpp: 7,208; pascal: 4,951; javascript: 3,091; asm: 2,817; yacc: 2,411; makefile: 696; xml: 446; python: 301; awk: 148
file content (53 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--TEST--
Bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables)
--FILE--
<?php
$a = new ArrayObject();

$b = array();

$a[null]['hurr'] = 'durr';

var_dump($a['epic_magic']);
var_dump($b['epic_magic']);
var_dump($c['epic_magic']); // Undefined var!!

$d = array();
var_dump($a['epic_magic']); // more magic!
var_dump($d['epic_magic']);

$e = 'srsly?';
var_dump($a['epic_magic']); // srsly.
var_dump(isset($a['epic_magic']));

$fp = fopen(__FILE__, 'r');
var_dump($a[$fp]);

fclose($fp);
?>
--EXPECTF--
Warning: Undefined array key "epic_magic" in %s on line %d
NULL

Warning: Undefined array key "epic_magic" in %s on line %d
NULL

Warning: Undefined variable $c in %s on line %d

Warning: Trying to access array offset on null in %s on line %d
NULL

Warning: Undefined array key "epic_magic" in %s on line %d
NULL

Warning: Undefined array key "epic_magic" in %s on line %d
NULL

Warning: Undefined array key "epic_magic" in %s on line %d
NULL
bool(false)

Warning: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d

Warning: Undefined array key %d in %s on line %d
NULL