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