bug36825.phpt 418 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Bug #36825 (Exceptions thrown in ArrayObject::offsetGet cause segfault)
  3. --FILE--
  4. <?php
  5. class foo extends ArrayObject
  6. {
  7. public function offsetGet($key): mixed
  8. {
  9. echo __METHOD__ . "($key)\n";
  10. throw new Exception("hi");
  11. }
  12. }
  13. $test = new foo();
  14. try
  15. {
  16. var_dump($test['bar']);
  17. }
  18. catch (Exception $e)
  19. {
  20. echo "got exception\n";
  21. }
  22. ?>
  23. --EXPECT--
  24. foo::offsetGet(bar)
  25. got exception