php-src/Zend/tests/bug30725.phpt

33 lines
383 B
Plaintext
Raw Normal View History

2005-01-25 03:16:06 +08:00
--TEST--
Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within foreach)
--FILE--
2018-09-17 01:16:42 +08:00
<?php
2005-01-25 03:16:06 +08:00
class Test implements IteratorAggregate
{
function getIterator()
{
throw new Exception();
}
}
try
2018-09-17 01:16:42 +08:00
{
2005-01-25 03:16:06 +08:00
$it = new Test;
foreach($it as $v)
{
echo "Fail\n";
}
echo "Wrong\n";
}
catch(Exception $e)
{
echo "Caught\n";
}
?>
===DONE===
2005-01-25 04:02:55 +08:00
--EXPECT--
2005-01-25 03:16:06 +08:00
Caught
===DONE===