ex = ((zend_generator *) Z_OBJ_P(generator))->execute_data;
if (!ex) {
- zend_throw_exception(NULL, "Cannot create ReflectionGenerator based on a terminated Generator", 0);
+ _DO_THROW("Cannot create ReflectionGenerator based on a terminated Generator");
return;
}
#define REFLECTION_CHECK_VALID_GENERATOR(ex) \
if (!ex) { \
- zend_throw_exception(NULL, "Cannot fetch information from a terminated Generator", 0); \
+ _DO_THROW("Cannot fetch information from a terminated Generator"); \
return; \
}
--- /dev/null
+--TEST--
+ReflectionGenerator::getTrace()
+--FILE--
+<?php
+function foo()
+{
+ yield 1;
+}
+
+$g = foo();
+$r = new ReflectionGenerator($g);
+
+$g->next();
+
+try {
+ $r->getTrace();
+} catch (ReflectionException $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECTF--
+Cannot fetch information from a terminated Generator
--- /dev/null
+--TEST--
+ReflectionGenerator::__construct()
+--FILE--
+<?php
+function foo()
+{
+ yield 1;
+}
+
+$g = foo();
+$g->next();
+
+try {
+ $r = new ReflectionGenerator($g);
+} catch (ReflectionException $e) {
+ echo "Done!\n";
+}
+?>
+--EXPECTF--
+Done!