objects_034.phpt 568 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Array object clobbering by user error handler
  3. --FILE--
  4. <?php
  5. class A implements ArrayAccess {
  6. public function &offsetGet($n): mixed {
  7. return null;
  8. }
  9. public function offsetSet($n, $v): void {
  10. }
  11. public function offsetUnset($n): void {
  12. }
  13. public function offsetExists($n): bool {
  14. return false;
  15. }
  16. }
  17. set_error_handler(function () {
  18. $GLOBALS['a'] = null;
  19. });
  20. $a = new A;
  21. $a[$c] = 'x' ;
  22. var_dump($a);
  23. $a = new A;
  24. $a[$c] .= 'x' ;
  25. var_dump($a);
  26. $a = new A;
  27. $a[$c][$c] = 'x' ;
  28. var_dump($a);
  29. ?>
  30. --EXPECT--
  31. NULL
  32. NULL
  33. NULL