diff options
Diffstat (limited to 'Zend/tests/generators/yield_from_valid_exception.phpt')
-rw-r--r-- | Zend/tests/generators/yield_from_valid_exception.phpt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Zend/tests/generators/yield_from_valid_exception.phpt b/Zend/tests/generators/yield_from_valid_exception.phpt new file mode 100644 index 0000000000..3af35f53af --- /dev/null +++ b/Zend/tests/generators/yield_from_valid_exception.phpt @@ -0,0 +1,29 @@ +--TEST-- +Exception from valid() during yield from +--FILE-- +<?php + +class FooBar implements Iterator { + function rewind() {} + function current() {} + function key() {} + function next() {} + function valid() { + throw new Exception("Exception from valid()"); + } +} + +function gen() { + try { + yield from new FooBar; + } catch (Exception $e) { + echo $e->getMessage(), "\n"; + } +} + +$x = gen(); +$x->current(); + +?> +--EXPECT-- +Exception from valid() |