xref: /PHP-5.4/ext/spl/tests/bug52238.phpt (revision 896ac689)
1--TEST--
2Bug #52238 - Crash when an Exception occurred in iterator_to_array
3--FILE--
4<?php
5class Foo implements IteratorAggregate
6{
7    public function bar() {
8        throw new Exception;
9    }
10
11    public function getIterator() {
12        return new ArrayIterator($this->bar());
13    }
14}
15var_dump(iterator_to_array(new Foo));
16?>
17--EXPECTF--
18Fatal error: Uncaught exception 'Exception' in %s
19Stack trace:
20#0 %s: Foo->bar()
21#1 [internal function]: Foo->getIterator()
22#2 %s: iterator_to_array(Object(Foo))
23#3 {main}
24  thrown in %s on line %d
25