File size: 413 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--TEST--
Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within foreach)
--FILE--
<?php

class Test implements IteratorAggregate
{
    function getIterator(): Traversable
    {
        throw new Exception();
    }
}

try
{
    $it = new Test;
    foreach($it as $v)
    {
        echo "Fail\n";
    }
    echo "Wrong\n";
}
catch(Exception $e)
{
    echo "Caught\n";
}

?>
--EXPECT--
Caught