Re: set_error_handler() and fatal errors?

From: Date: Wed, 13 Dec 2000 21:09:44 +0000
Subject: Re: set_error_handler() and fatal errors?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-41221@lists.php.net to get a copy of this message
This functionality would be very wonderful to have! :) --zak ----- Original Message ----- From: "Rasmus Lerdorf" <rasmus@linuxcare.com> To: <php-dev@lists.php.net> Sent: Wednesday, December 13, 2000 11:39 AM Subject: [PHP-DEV] set_error_handler() and fatal errors? > I think set_error_handler() should be able to catch fatal errors as well > as the non-fatal ones if possible. The current documentation indicates > that fatal errors can be caught, but it doesn't actually work. This > script for example: > > <? > error_reporting(E_ERROR|E_WARNING|E_PARSE|E_NOTICE|E_CORE_ERROR|E_CORE_WARNI NG|E_COMPILE_ERROR|E_COMPILE_WARNING|E_USER_ERROR|E_USER_WARNING|E_USER_NOTI CE); > > function myHandler($errno, $errstr, $errfile, $errline) { > echo "$errno: $errstr on line $errline in $errfile\n"; > } > > set_error_handler("myHandler"); > echo $a; > blah(); > ?> > > Gives me: > > 8: Undefined variable: a on line 9 in t > <br> > <b>Fatal error</b>: Call to undefined function: blah() in <b>t</b> on line <b>10</b><br> > > which shows that MyHandler() was only called for the undefined variable > problem. > > If we can't catch fatal errors for some reason we need to reflect this in > the documentation. Looking at the code I don't see any real reason not to > be able to catch fatal errors. > > -Rasmus > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.dev (#41221) next »