]> granicus.if.org Git - php/commitdiff
Forgot to add test
authorNikita Popov <nikic@php.net>
Mon, 13 Aug 2012 17:24:44 +0000 (19:24 +0200)
committerNikita Popov <nikic@php.net>
Mon, 13 Aug 2012 17:24:44 +0000 (19:24 +0200)
Zend/tests/generators/finally_uninterrupted.phpt [new file with mode: 0644]

diff --git a/Zend/tests/generators/finally_uninterrupted.phpt b/Zend/tests/generators/finally_uninterrupted.phpt
new file mode 100644 (file)
index 0000000..64c9438
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Use of finally in generator without interrupt
+--FILE--
+<?php
+
+function gen() {
+    try {
+        throw new Exception;
+    } finally {
+        echo "finally run\n";
+    }
+
+    yield; // force generator
+}
+
+$gen = gen();
+$gen->rewind(); // force run
+
+?>
+--EXPECTF--
+finally run
+
+Fatal error: Uncaught exception 'Exception' in %s:%d
+Stack trace:
+#0 [internal function]: gen()
+#1 %s(%d): Generator->rewind()
+#2 {main}
+  thrown in %s on line %d