set_error_handler() not handling E_ERROR
| From: | Chris Newbill | Date: | Sun, 14 Jan 2001 05:40:56 +0000 |
| Subject: | set_error_handler() not handling E_ERROR | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-44039@lists.php.net to get a copy of this message | ||
PHP Version 4.0.3pl1 and 4.0.4
It was my understanding that when using set_error_handler() ALL errors were
sent to the users function? This does not seem to be happening.
error.lib
$oeh = set_error_handler("dosojin_ERROR");
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR |
E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE);
tmp.php
<?
include("dosojin.lib"); // constants only
include("error.lib"); // error handling routines
function foo($var)
{
print "Hello, $var!\n";
}
foo();
$i = 1;
$i->noFunc();
?>
# php -q tmp.php
<PRE CLASS=error>
(2) Missing argument 1 for foo()
</PRE>
Hello
<br>
<b>Fatal error</b>: Call to a member function on a non-object in
<b>tmp.php</b> on line <b>14</b><br>
You can see that E_WARNING is getting shuffled to the user function, but
E_ERROR is not.
Thanks,
Chris Newbill