bug75420.15.phpt 486 B

1234567891011121314151617181920
  1. --TEST--
  2. Bug #75420.15 (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["name"] = 24; var_dump($x); }
  9. public function offsetUnset($x): void { }
  10. }
  11. $obj = new Test;
  12. $name = "foo";
  13. $name = str_repeat($name, 2);
  14. $obj[$name] = 1;
  15. var_dump($name);
  16. ?>
  17. --EXPECT--
  18. string(6) "foofoo"
  19. int(24)