mirror of
https://github.com/php/php-src.git
synced 2024-12-19 15:00:15 +08:00
24 lines
393 B
PHP
24 lines
393 B
PHP
--TEST--
|
|
Empty foreach loops with exception must not leak
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo implements IteratorAggregate {
|
|
public function getIterator() {
|
|
return new ArrayIterator([]);
|
|
}
|
|
public function __destruct() {
|
|
throw new Exception;
|
|
}
|
|
}
|
|
|
|
try {
|
|
foreach (new Foo as $x);
|
|
} catch (Exception $e) {
|
|
echo "Exception caught\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Exception caught
|