#20072 [Com]: set_error_handler doesn't accept Class::function()
| From: | mark at tapinternet dot com | Date: | Thu, 24 Oct 2002 22:34:59 +0000 |
| Subject: | #20072 [Com]: set_error_handler doesn't accept Class::function() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-23255@lists.php.net to get a copy of this message | ||
ID: 20072
Comment by: mark@tapinternet.com
Reported By: mark@tapinternet.com
Status: Open
Bug Type: Feature/Change Request
Operating System: mandrake-9
PHP Version: 4.2.3
New Comment:
I don't think this is fully functional. Correct me if I'm
wrong but an error handler of
"Class::function"
and
"function"
should not function any different if they are the same
code. Use the code below, and uncomment each of the two
set_error_handler() calls differnetly. You will see that
the plain function captures the error, while the
Class::function does not.
<?
class ErrorClass {
function _errorHandler ($level, $message, $file,
$line, $context) {
static $count;
print "\n\n got ".++$count." errors\n\n
$message \n\n";
}
}
function _errorHandler ($level, $message, $file,
$line, $context) {
static $count;
print "\n\n got ".++$count." errors\n\n
$message \n\n";
}
//test code
error_reporting (E_USER_ERROR | E_USER_WARNING |
E_USER_NOTICE);
//set_error_handler('_errorHandler');
//set_error_handler(array("ErrorClass","_errorHandler"));
while( list($k,$v) = each($notarray) ) {
//...
}
?>
Previous Comments:
------------------------------------------------------------------------
[2002-10-24 15:17:23] hholzgra@php.net
the syntax for class method callbacks is
set_error_handler(array("ErrorClass","handler"))
although i like your idea of how it could look like
moved to feature requests
------------------------------------------------------------------------
[2002-10-24 14:17:20] mark@tapinternet.com
set_error_handler() does not accept static class functions
as a custom error handling function.
set_error_handler('ErrorClass::handler') will not report
false if called twice in succession. But it will also not
route errors through the static class function. Either it
should return false so that a script can realize the input
was not handled properly, or it should route errors
throught the static class function.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20072&edit=1