Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59067 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11165 invoked from network); 19 Mar 2012 21:32:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2012 21:32:54 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:1039] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/35-19822-306A76F4 for ; Mon, 19 Mar 2012 16:32:52 -0500 Received: (qmail 95908 invoked by uid 98); 19 Mar 2012 21:32:53 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.037345 secs); 19 Mar 2012 21:32:53 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 19 Mar 2012 21:32:52 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 19 Mar 2012 16:32:53 -0500 Message-ID: In-Reply-To: References: Date: Mon, 19 Mar 2012 16:32:53 -0500 To: internals@lists.php.net User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] i hope using set_exception_handler and set_error_handler in php extension code. From: ceo@l-i-e.com ("Richard Lynch") 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