xref: /PHP-8.3/Zend/tests/033.phpt (revision 7936c808)
1--TEST--
2Using undefined multidimensional array
3--FILE--
4<?php
5
6$arr[1][2][3][4][5];
7
8echo $arr[1][2][3][4][5];
9
10$arr[1][2][3][4][5]->foo;
11
12try {
13    $arr[1][2][3][4][5]->foo = 1;
14} catch (Error $e) {
15    echo $e->getMessage(), "\n";
16}
17
18$arr[][] = 2;
19
20try {
21    $arr[][]->bar = 2;
22} catch (Error $e) {
23    echo $e->getMessage(), "\n";
24}
25
26?>
27--EXPECTF--
28Warning: Undefined variable $arr in %s on line %d
29
30Warning: Trying to access array offset on null in %s on line %d
31
32Warning: Trying to access array offset on null in %s on line %d
33
34Warning: Trying to access array offset on null in %s on line %d
35
36Warning: Trying to access array offset on null in %s on line %d
37
38Warning: Trying to access array offset on null in %s on line %d
39
40Warning: Undefined variable $arr in %s on line %d
41
42Warning: Trying to access array offset on null in %s on line %d
43
44Warning: Trying to access array offset on null in %s on line %d
45
46Warning: Trying to access array offset on null in %s on line %d
47
48Warning: Trying to access array offset on null in %s on line %d
49
50Warning: Trying to access array offset on null in %s on line %d
51
52Warning: Undefined variable $arr in %s on line %d
53
54Warning: Trying to access array offset on null in %s on line %d
55
56Warning: Trying to access array offset on null in %s on line %d
57
58Warning: Trying to access array offset on null in %s on line %d
59
60Warning: Trying to access array offset on null in %s on line %d
61
62Warning: Trying to access array offset on null in %s on line %d
63
64Warning: Attempt to read property "foo" on null in %s on line %d
65Attempt to assign property "foo" on null
66Attempt to assign property "bar" on null
67