clone_004.phpt 334 B

123456789101112131415161718192021
  1. --TEST--
  2. Testing usage of object as array on clone statement
  3. --FILE--
  4. <?php
  5. class foo {
  6. public function __get($a) {
  7. return new $this;
  8. }
  9. }
  10. $c = new foo;
  11. $a = clone $c->b[1];
  12. ?>
  13. --EXPECTF--
  14. Fatal error: Uncaught Error: Cannot use object of type foo as array in %s:%d
  15. Stack trace:
  16. #0 {main}
  17. thrown in %s on line %d