File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Yield from non-iterable
3+ --FILE--
4+ <?php
5+
6+ function gen () {
7+ yield from new stdClass ;
8+ }
9+
10+ try {
11+ gen ()->current ();
12+ } catch (Error $ e ) {
13+ echo $ e ->getMessage (), "\n" ;
14+ }
15+
16+ ?>
17+ --EXPECT--
18+ Can use "yield from" only with arrays and Traversables
Original file line number Diff line number Diff line change @@ -8067,6 +8067,7 @@ ZEND_VM_C_LABEL(yield_from_try_again):
80678067 ZEND_VM_C_GOTO (yield_from_try_again );
80688068 } else {
80698069 zend_throw_error (NULL , "Can use \"yield from\" only with arrays and Traversables" );
8070+ FREE_OP1 ();
80708071 UNDEF_RESULT ();
80718072 HANDLE_EXCEPTION ();
80728073 }
Original file line number Diff line number Diff line change @@ -4545,6 +4545,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
45454545 goto yield_from_try_again;
45464546 } else {
45474547 zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
4548+
45484549 UNDEF_RESULT();
45494550 HANDLE_EXCEPTION();
45504551 }
@@ -13707,6 +13708,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER
1370713708 goto yield_from_try_again;
1370813709 } else {
1370913710 zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
13711+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
1371013712 UNDEF_RESULT();
1371113713 HANDLE_EXCEPTION();
1371213714 }
@@ -37728,6 +37730,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
3772837730 goto yield_from_try_again;
3772937731 } else {
3773037732 zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
37733+
3773137734 UNDEF_RESULT();
3773237735 HANDLE_EXCEPTION();
3773337736 }
You can’t perform that action at this time.
0 commit comments