xref: /PHP-8.1/ext/spl/tests/bug80719.phpt (revision c34c5234)
1--TEST--
2Bug #80719: Iterating after failed ArrayObject::setIteratorClass() causes Segmentation fault
3--FILE--
4<?php
5
6$array = new ArrayObject([42]);
7try {
8    $array->setIteratorClass(FilterIterator::class);
9} catch (TypeError $e) {
10    echo $e->getMessage(), "\n";
11}
12foreach ($array as $v) {
13    var_dump($v);
14}
15
16?>
17--EXPECT--
18ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, FilterIterator given
19int(42)
20