bug75420.16.phpt 461 B

1234567891011121314151617181920
  1. --TEST--
  2. Bug #75420.16 (Indirect modification of magic method argument)
  3. --FILE--
  4. <?php
  5. class Test implements ArrayAccess {
  6. public function offsetExists($x): bool { }
  7. public function offsetGet($x): mixed { }
  8. public function offsetSet($x, $y): void { $GLOBALS["obj"] = 24; var_dump($this); }
  9. public function offsetUnset($x): void { }
  10. }
  11. $obj = new Test;
  12. $name = "foo";
  13. $obj[$name] = 1;
  14. var_dump($obj);
  15. ?>
  16. --EXPECT--
  17. object(Test)#1 (0) {
  18. }
  19. int(24)