mirror of
https://github.com/php/php-src.git
synced 2024-12-22 08:20:23 +08:00
23 lines
482 B
Plaintext
23 lines
482 B
Plaintext
|
--TEST--
|
||
|
Exception inside a foreach loop with return
|
||
|
--FILE--
|
||
|
<?php
|
||
|
class saboteurTestController {
|
||
|
public function isConsistent() { throw new \Exception(); }
|
||
|
}
|
||
|
|
||
|
$controllers = array(new saboteurTestController(),new saboteurTestController());
|
||
|
foreach ($controllers as $controller) {
|
||
|
try {
|
||
|
if ($controller->isConsistent()) {
|
||
|
return $controller;
|
||
|
}
|
||
|
} catch (\Exception $e) {
|
||
|
echo "Exception\n";
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
--EXPECT--
|
||
|
Exception
|
||
|
Exception
|