1--TEST--
2SPL: iterator_count() throws if the Iterator throws
3--FILE--
4<?php
5
6function generator() {
7  yield 1;
8  throw new Exception('Iterator failed');
9}
10
11var_dump(iterator_count(generator()));
12
13?>
14--EXPECTF--
15Fatal error: Uncaught Exception: Iterator failed in %siterator_count_exception.php:5
16Stack trace:
17#0 [internal function]: generator()
18#1 %siterator_count_exception.php(8): iterator_count(Object(Generator))
19#2 {main}
20  thrown in %siterator_count_exception.php on line 5
21