026.phpt 420 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Trying assign value to property when an object is not returned in a function
  3. --FILE--
  4. <?php
  5. class foo {
  6. public function a() {
  7. }
  8. }
  9. $test = new foo;
  10. $test->a()->a;
  11. print "ok\n";
  12. try {
  13. $test->a()->a = 1;
  14. } catch (Error $e) {
  15. echo $e->getMessage(), "\n";
  16. }
  17. print "ok\n";
  18. ?>
  19. --EXPECTF--
  20. Warning: Attempt to read property "a" on null in %s on line %d
  21. ok
  22. Attempt to assign property "a" on null
  23. ok