mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
First pass at moving `Zend/tests/bug*` tests to existing sub directories Work towards GH-15631
31 lines
413 B
PHP
31 lines
413 B
PHP
--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
|