--TEST-- Generators can throw exceptions --FILE-- current()); try { $gen->next(); } catch (Exception $e) { echo 'Caught exception with message "', $e->getMessage(), '"', "\n"; } var_dump($gen->current()); ?> --EXPECT-- string(3) "foo" Caught exception with message "test" NULL