com php-src: Merge branch 'PHP-5.6': Zend/tests/bug69740.phpt Zend/zend_generators.c
| From: | Nikita Popov | Date: | Thu, 11 Jun 2015 15:44:51 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6': Zend/tests/bug69740.phpt Zend/zend_generators.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87214@lists.php.net to get a copy of this message | ||
Commit: 580eb56fb78456144918c3053676c46cd2cee529
Author: Nikita Popov <nikic@php.net> Thu, 11 Jun 2015 17:44:51 +0200
Parents: 8cfe28259ed0b0bebb72d8292abc877181b84d34 8405265578d2df8d76be223910b3e44aff4bdfef
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=580eb56fb78456144918c3053676c46cd2cee529
Log:
Merge branch 'PHP-5.6'
Conflicts:
Zend/zend_generators.c
Changed paths:
AM Zend/tests/bug69740.phpt
MM Zend/zend_generators.c
Diff:
diff --cc Zend/tests/bug69740.phpt
index 0000000,30a2a49...c8910b2
mode 000000,100644..100644
--- a/Zend/tests/bug69740.phpt
+++ b/Zend/tests/bug69740.phpt
@@@ -1,0 -1,28 +1,28 @@@
+ --TEST--
+ Bug #69740: finally in generator (yield) swallows exception in iteration
+ --FILE--
+ <?php
+
+ function generate() {
+ try {
+ yield 1;
+ yield 2;
+ } finally {
+ echo "finally\n";
+ }
+ }
+
+ foreach (generate() as $i) {
+ echo $i, "\n";
+ throw new Exception();
+ }
+
+ ?>
+ --EXPECTF--
+ 1
+ finally
+
-Fatal error: Uncaught exception 'Exception' in %s:%d
++Fatal error: Uncaught Exception in %s:%d
+ Stack trace:
+ #0 {main}
+ thrown in %s on line %d
diff --cc Zend/zend_generators.c
index 706d913,1cf9566..13304e9
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@@ -174,13 -196,13 +174,15 @@@ static void zend_generator_dtor_storage
/* If a finally block was found we jump directly to it and
* resume the generator. */
if (finally_op_num) {
- ex->opline = &ex->op_array->opcodes[finally_op_num];
- ex->fast_ret = NULL;
- ex->delayed_exception = EG(exception);
+ zval *fast_call = ZEND_CALL_VAR(ex, ex->func->op_array.opcodes[finally_op_end].op1.var);
+
- Z_OBJ_P(fast_call) = NULL;
++ Z_OBJ_P(fast_call) = EG(exception);
+ EG(exception) = NULL;
+ fast_call->u2.lineno = (uint32_t)-1;
+
+ ex->opline = &ex->func->op_array.opcodes[finally_op_num];
generator->flags |= ZEND_GENERATOR_FORCED_CLOSE;
- zend_generator_resume(generator TSRMLS_CC);
+ zend_generator_resume(generator);
}
}
/* }}} */