# restore user opcode handler in PHP

- Thread: https://externals.io/message/57811
- Original archive: https://news-web.php.net/php.internals/57811
- Started by yoram bar haim on 2012-02-12T13:24:12+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #57811 — yoram bar haim — 2012-02-12T13:24:12+00:00

URL: https://externals.io/message/57811#57811

The attatched patch solves the problem and I think it is more robust then 
adding a new function.
calling a function like the proposed zend_restore_user_opcode_handler() might 
be a problem in case someone else put handler before you.
instead of that it's easier to just tell zend_set_user_opcode_handler() to 
restore the opcode value in case the handler is NULL.
that will make the flow of zend_set_user_opcode_handler(<my_handler>) and then 
zend_set_user_opcode_handler(<orig_handler>) simpler.

a patch is attatched and tested.


> Hi:
>   could you file a feature req on bugs.php.net?
> 
>   I think it's okey to add a zend_restore_user_handler .
> 
>   like:
> 
>   ZEND_API int zend_restore_user_opcode_handler(zend_uchar opcode) {
>     zend_user_opcodes[opcode] = opcode;
>     zend_user_opcode_handlers[opcode] = NULL;
>     return SUCCESS;
>   }
> 
>   but it still need dmitry to review  :)
> 
>  thanks
> 
> 
> > […]
