summaryrefslogtreecommitdiff
path: root/Zend/tests/bug30725.phpt
blob: b2ed209bcd10490330a05af7fb8dc673b2df637d (plain)
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
--TEST--
Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within foreach)
--FILE--
<?php

class Test implements IteratorAggregate
{
    function getIterator()
    {
        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