1--TEST--
2SPL: Error: iterator_to_array when the current operation throws an exception
3--FILE--
4<?php
5
6class MyArrayIterator extends ArrayIterator {
7	public function current() {
8		throw new Exception('Make the iterator break');
9	}
10}
11
12$it = new MyArrayIterator(array(4, 6, 2));
13
14try {
15	// get keys
16	$ar = iterator_to_array($it);
17} catch (Exception $e) {
18	echo $e->getMessage() . PHP_EOL;
19}
20
21try {
22	// get values
23	$ar = iterator_to_array($it, false);
24} catch (Exception $e) {
25	echo $e->getMessage() . PHP_EOL;
26}
27
28?>
29
30<?php exit(0); ?>
31--EXPECT--
32Make the iterator break
33Make the iterator break
34