temporary_cleaning_007.phpt 481 B

12345678910111213141516171819202122
  1. --TEST--
  2. Exception inside a foreach loop with return
  3. --FILE--
  4. <?php
  5. class saboteurTestController {
  6. public function isConsistent() { throw new \Exception(); }
  7. }
  8. $controllers = array(new saboteurTestController(),new saboteurTestController());
  9. foreach ($controllers as $controller) {
  10. try {
  11. if ($controller->isConsistent()) {
  12. return $controller;
  13. }
  14. } catch (\Exception $e) {
  15. echo "Exception\n";
  16. }
  17. }
  18. ?>
  19. --EXPECT--
  20. Exception
  21. Exception