Bug #12136: set_error_handler doesn't trap all errors
| From: | scott at datalink dot net dot au | Date: | Fri, 13 Jul 2001 09:21:20 +0000 |
| Subject: | Bug #12136: set_error_handler doesn't trap all errors | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-59945@lists.php.net to get a copy of this message | ||
From: scott@datalink.net.au
Operating system: Redhat Linux 7.0
PHP version: 4.0.6
PHP Bug Type: Scripting Engine problem
Bug description: set_error_handler doesn't trap all errors
I believe this is the same bug as bug report 11803, but I think the scope
is wider than initially reported.
The bug: set_error_handler does not trap an error if I try to call a method
that does not exist.
This is causing grief when a PEAR-style method returns one type of object
on success and another on failure. The code expecting the success will
call a non-existant method.
Here's some code to emulate the problem:
<?php
// set up my custom error handler
set_error_handler("handleError");
function handleError($errno, $errstr, $errfile, $errline, $obj)
{
print "<b>My Error Handler:</b> $errstr on line $errline";
}
// define a really basic class
class Foo
{
var $i;
}
$myFoo = new Foo();
// call a non-existant property (this calls the errorHandler OK)
print $myFoo->choo;
// now call a non-existant method (this bypasses the errorHandler!!!)
$myFoo->bar();
?>
--
Edit bug report at: http://bugs.php.net/?id=12136&edit=1