This RPC has been obsolete. Please see https://github.com/php/php-src/pull/2902 for more detail.
There is no API for change the Zend VM's execute flow. The only approach to change the Zend VM's execute flow is introducing a new keyword and making a new opline, and use ZEND_VM_RETURN/ZEND_VM_CONTINUE macro in its handler.
So it is impossible to change the Zend VM's execute flow in an zend extension. As a result, any feature, like Fiber, related to Zend VM's execute flow cannot be implemented by a standalone extension.
This PRFC propose a new vm_interrupt type, by which some zend extension could make the zend vm execution pause and return. So we can implement feature like Fiber in a standalone extension.
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 183072033607..bd7408e824fc 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -8893,13 +8893,19 @@ ZEND_VM_DEFINE_OP(137, ZEND_OP_DATA); ZEND_VM_HELPER(zend_interrupt_helper, ANY, ANY) { + int8_t interrupt_type = EG(vm_interrupt); + EG(vm_interrupt) = 0; if (EG(timed_out)) { zend_timeout(0); } else if (zend_interrupt_function) { SAVE_OPLINE(); zend_interrupt_function(execute_data); - ZEND_VM_ENTER(); + if (UNEXPECTED(interrupt_type == 2)) { + ZEND_VM_RETURN(); + } else { + ZEND_VM_ENTER(); + } } ZEND_VM_CONTINUE(); }
None
PHP 7.3
But I would like this patch could be backported to PHP 7.1 and PHP 7.2.
None
None
None
None
None
None
Make sure there are no open issues when the vote starts!
List existing areas/features of PHP that will not be changed by the RFC.
This helps avoid any ambiguity, shows that you have thought deeply about the RFC's impact, and helps reduces mail list noise.
This sections details areas where the feature might be improved in future, but that are not currently proposed in this RFC.
50%+1
After the project is implemented, this section should contain
Links to external references, discussions or RFCs
Keep this updated with features that were discussed on the mail lists.