Re: intercepting function calls
| From: | Sara Golemon | Date: | Wed, 09 Feb 2005 15:57:04 +0000 |
| Subject: | Re: intercepting function calls | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-14751@lists.php.net to get a copy of this message | ||
> Is it possible to intercept a function call (user
> space or built-in) in the Zend Engine and execute user
> space code before/after the function call?
>
Yes, you can do this by way of a Zend extension (not a PHP extension mind
you).
The parts of Zend/zend_extensions.h you'll want to pay attention to are:
typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array);
typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array);
struct _zend_extension {
...
fcall_begin_handler_func_t fcall_begin_handler;
fcall_end_handler_func_t fcall_end_handler;
...
};
-Sara