php-src/Zend/tests/dereference_014.phpt
2020-07-10 21:05:28 +02:00

39 lines
693 B
PHP

--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