xref: /PHP-8.2/ext/spl/tests/array_021.phpt (revision f8d79582)
1--TEST--
2SPL: ArrayObject::seek() and exceptions
3--FILE--
4<?php
5
6class foo extends ArrayObject
7{
8    public function seek($key)
9    {
10        echo __METHOD__ . "($key)\n";
11        throw new Exception("hi");
12    }
13}
14
15$test = new foo(array(1,2,3));
16
17try
18{
19    $test->seek('bar');
20}
21catch (Exception $e)
22{
23    echo "got exception\n";
24}
25
26?>
27--EXPECT--
28foo::seek(bar)
29got exception
30