xref: /PHP-7.4/Zend/tests/dereference_014.phpt (revision c42b7dd6)
1--TEST--
2Trying to create an object from dereferencing uninitialized variable
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8class foo {
9	public $x;
10	static public $y;
11
12	public function a() {
13		return $this->x;
14	}
15
16	static public function b() {
17		return self::$y;
18	}
19}
20
21$foo = new foo;
22$h = $foo->a()[0]->a;
23var_dump($h);
24
25$h = foo::b()[1]->b;
26var_dump($h);
27
28?>
29--EXPECTF--
30Notice: Trying to access array offset on value of type null in %s on line %d
31
32Notice: Trying to get property 'a' of non-object in %s on line %d
33NULL
34
35Notice: Trying to access array offset on value of type null in %s on line %d
36
37Notice: Trying to get property 'b' of non-object in %s on line %d
38NULL
39