From: Nikita Popov Date: Fri, 10 Jun 2016 13:57:18 +0000 (+0200) Subject: Fixed bug #72373 X-Git-Tag: php-7.1.0alpha3~25^2~5^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=792e89385ca6fc722a03590722eb7745a2374720;p=php Fixed bug #72373 --- diff --git a/NEWS b/NEWS index de57cceff7..e67720a5a8 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2016, PHP 7.1.0alpha2 +- Core: + . Fixed bug #72373 (TypeError after Generator function w/declared return type + finishes). (Nikita) 09 Jun 2016, PHP 7.1.0alpha1 diff --git a/Zend/tests/bug72373.phpt b/Zend/tests/bug72373.phpt new file mode 100644 index 0000000000..67377c5ba7 --- /dev/null +++ b/Zend/tests/bug72373.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #72373: TypeError after Generator function w/declared return type finishes +--FILE-- + +--EXPECT-- +1 +2 +3 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 30d28cd842..2b935a8f4d 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2329,7 +2329,8 @@ void zend_emit_final_return(int return_one) /* {{{ */ zend_op *ret; zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; - if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { + if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE + && !(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR)) { zend_emit_return_type_check(NULL, CG(active_op_array)->arg_info - 1, 1); }