1--TEST--
2Traversables that throw exceptions are properly handled during argument unpack
3--FILE--
4<?php
5
6function test(...$args) {
7    var_dump($args);
8}
9
10class Foo implements IteratorAggregate {
11    public function getIterator() {
12        throw new Exception('getIterator');
13    }
14}
15
16function gen() {
17    yield 1;
18    yield 2;
19    throw new Exception('gen');
20}
21
22try {
23    test(1, 2, ...new Foo, ...[3, 4]);
24} catch (Exception $e) { var_dump($e->getMessage()); }
25
26try {
27    test(1, 2, ...gen(), ...[3, 4]);
28} catch (Exception $e) { var_dump($e->getMessage()); }
29
30?>
31--EXPECT--
32string(11) "getIterator"
33string(3) "gen"
34