--TEST-- Stack is cleaned up properly when an exception is thrown during a function call --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