RE: [PHP] Error Handler Problem
| From: | Dan Vande More | Date: | Sat, 09 Mar 2002 15:14:07 +0000 |
| Subject: | RE: [PHP] Error Handler Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87874@lists.php.net to get a copy of this message | ||
I'm not understanding completely, but could this have something to do with
it?
[quote]
error_reporting() has no effect if you have defined your own error handler
with set_error_handler()
[Editor's Note: This is not quite accurate.
E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and
E_COMPILE_WARNING error levels will be handled as per the error_reporting
settings.
All other levels of errors will be passed to the custom error handler
defined by set_error_handler().
Zeev Suraski suggests that a simple way to use the defined levels of error
reporting with your custom error handlers is to add the following line to
the top of your error handling function:
if (!($type & error_reporting())) return;
-zak@php.net]
[/quote]
Read:
http://www.php.net/manual/en/function.error-reporting.php
Dan
-----Original Message-----
From: S.Murali Krishna [mailto:smk_bk@yahoo.com]
Sent: Saturday, March 09, 2002 6:43 AM
To: php-general@lists.php.net
Subject: [PHP] Error Handler Problem
Hi All,
I tell my requierment first. Just in short I want to capture a
error of "Undefined Function .so and so..." .
I set Error Handler to
E_ALL & ~E_ERROR and I set my own Error Handler to capture errors
then I called a Non-Existent Function intentionally.
in this case its not at all capturing the error and silently executing
the program.
Can anyone tell me what is the workaround this.
For clarification here is the code.
<?php
function ErrorHandler($Errcode, $Errmsg )
{
print "ErrorCode: " . $Errcode . "\n" ;
print "ErrorMsg : " . $Errmsg . "\n" ;
return false ;
}
error_reporting(E_ALL & ~E_ERROR);
$prev_hand = set_error_handler("ErrorHandler");
// It's always executing if section instead of else.
if(!$prev_hand) {
print "Unable to set error handler\n" ;
} else {
print "Previous Handler" . $prev_hand ;
}
?>
<smk_bk@yahoo.com>
-------------------------------------------------------------------
We must use time wisely and forever realize that the time is
always ripe to do right."
-- Nelson Mandela
-------------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php