mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
33 lines
395 B
PHP
Executable File
33 lines
395 B
PHP
Executable File
--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";
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
Caught
|
|
===DONE===
|