xref: /PHP-7.4/ext/spl/tests/bug72684.phpt (revision 4c2e1a13)
1--TEST--
2Bug #72684 (AppendIterator segfault with closed generator)
3--FILE--
4<?php
5
6function createGenerator() { yield 1; }
7$generator = createGenerator();
8
9$appendIterator = new AppendIterator();
10$appendIterator->append($generator);
11
12iterator_to_array($appendIterator);
13try {
14	iterator_to_array($appendIterator);
15} catch (\Exception $e) {
16	echo $e->getMessage();
17}
18
19?>
20--EXPECT--
21Cannot traverse an already closed generator
22