mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
24 lines
393 B
Plaintext
24 lines
393 B
Plaintext
|
--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
|