Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] i hope using set_exception_handler and set_error_handler in php extension code.

Posted by langwan 
i hope using set_exception_handler and set_error_handler in php extension
code.
hi, all:

i write php monitor extension now.

1. question

i hope using set_exception_handler or set_error_handler in
PHP_RINIT_FUNCTION()

for example:

PHP_RINIT_FUNCTION(my)
{
set_exception_handler(my_exception_handler);
}

please help me.

2. question

i hope print $e->getMessage() info in PHP_FUNCTION(my_exception_handler).

thk all help me.

--
langwan
On Fri, March 16, 2012 8:33 pm, langwan wrote:
> i hope using set_exception_handler and set_error_handler in php
> extension
> code.
> hi, all:
>
> i write php monitor extension now.
>
> 1. question
>
> i hope using set_exception_handler or set_error_handler in
> PHP_RINIT_FUNCTION()
>
> for example:
>
> PHP_RINIT_FUNCTION(my)
> {
> set_exception_handler(my_exception_handler);
> }
>
> please help me.

You need to separate PHP userland functions (http://php.net/) from C
functions in core/extensions (http://lxr.php.net/)

Find the C source for PHP set_exception_handler in LXR, and see what
it calls. Then call the same thing.

> 2. question
>
> i hope print $e->getMessage() info in
> PHP_FUNCTION(my_exception_handler).

You'll have to find the Exception structure somewhere in the guts of
try/catch implementation, probably tied to the yacc (bison?) (I
forget) code that gets turned into the basic syntax.

There should be some kind of base Exception struct somewhere in there,
that will probably have a "message" element.

You're trying to write an extension in C. You'll have to find the
underlying C function for any PHP function, and figure out enough
about how it works to re-tool it to your needs.

Hope that helps.

PS
I am *so* not an expert, but I stumbled my way through writing a
sample extension once.


--
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login