dereference_014.phpt 693 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Trying to create an object from dereferencing uninitialized variable
  3. --FILE--
  4. <?php
  5. error_reporting(E_ALL);
  6. class foo {
  7. public $x;
  8. static public $y;
  9. public function a() {
  10. return $this->x;
  11. }
  12. static public function b() {
  13. return self::$y;
  14. }
  15. }
  16. $foo = new foo;
  17. $h = $foo->a()[0]->a;
  18. var_dump($h);
  19. $h = foo::b()[1]->b;
  20. var_dump($h);
  21. ?>
  22. --EXPECTF--
  23. Warning: Trying to access array offset on value of type null in %s on line %d
  24. Warning: Attempt to read property "a" on null in %s on line %d
  25. NULL
  26. Warning: Trying to access array offset on value of type null in %s on line %d
  27. Warning: Attempt to read property "b" on null in %s on line %d
  28. NULL