summaryrefslogtreecommitdiff
path: root/Zend/tests/dereference_014.phpt
blob: 7b115cf48a076c13cc7a613b6d5f7bb7cc71144f (plain)
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
--TEST--
Trying to create an object from dereferencing uninitialized variable
--FILE--
<?php

error_reporting(E_ALL);

class foo {
    public $x;
    static public $y;

    public function a() {
        return $this->x;
    }

    static public function b() {
        return self::$y;
    }
}

$foo = new foo;
$h = $foo->a()[0]->a;
var_dump($h);

$h = foo::b()[1]->b;
var_dump($h);

?>
--EXPECTF--
Warning: Trying to access array offset on value of type null in %s on line %d

Warning: Attempt to read property 'a' on null in %s on line %d
NULL

Warning: Trying to access array offset on value of type null in %s on line %d

Warning: Attempt to read property 'b' on null in %s on line %d
NULL