On Sun, Aug 19, 2012 at 6:28 AM, Stas Malyshev <smalys...@sugarcrm.com> wrote:
> Hi!
>
>> For PHP we would need to have some similar behavior. PHP's current
>> exception model is incompatible with GeneratorExitException (because
>> PHP does not have BaseExceptions). So what I'd probably do instead is
>> monkeypatch a ZEND_RETURN opcode at the current execution position and
>
> Patching opcodes is not a good idea, since opcodes could be cached, and
> the cache can be shared between different processes.

Patching a single opcode should be okay, because it does not require
modification of the op_array. Only execute_data->opline has to be
changed (and the execute data is not shared). The exception handling
mechanism currently uses the same technique. It patches an
ZEND_HANDLE_EXCEPTION opcode into the current position.

Nikita

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to