#19136 [Opn->Csd]: set_error_handler not working as dcoumented
| From: | sander@php.net | Date: | Wed, 28 Aug 2002 17:55:00 +0000 |
| Subject: | #19136 [Opn->Csd]: set_error_handler not working as dcoumented | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18076@lists.php.net to get a copy of this message | ||
ID: 19136
Updated by: sander@php.net
Reported By: undreamdev@hotmail.com
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: linux 2.4.19 - RedHat
PHP Version: 4.2.2
New Comment:
I actually updated the docs... there was a bugreport about it but since
it worked fine here (4.3.0-dev), I updated the docs. Please try a
snapshot from http://snaps.php.net and reopen if the problem
persists.
Previous Comments:
------------------------------------------------------------------------
[2002-08-28 00:05:41] undreamdev@hotmail.com
here is my code. I have tried every combination of &$err/error_handler
I
could think off and none seem to work.
------------------------code---------------
<?php
$err = new Error();
//this should work but doesn't
$old_eh = set_error_handler(array(&$err, 'errorHandler'));
//this one works
//$old_eh = set_error_handler('errorHandler'));
// trigger my error.
trigger_error('This is a booboo!', E_USER_ERROR);
//begin error class
Class Error
{
function errorHandler($errno, $errstr, $errfile, $errline) {
switch ($errno) {
case FATAL:
echo "<b>FATAL</b> [$errno] $errstr<br>\n";
break;
case ERROR:
echo "<b>ERROR</b> [$errno] $errstr<br>\n";
break;
case WARNING:
echo "<b>WARNING</b> [$errno] $errstr<br>\n";
break;
default:
echo "Unkown error type: [$errno] $errstr<br>\n";
break;
}
}
} // end class
//same as above without being in a class
function errorHandler($errno, $errstr, $errfile, $errline) {
switch ($errno) {
case FATAL:
echo "<b>FATAL</b> [$errno] $errstr<br>\n";
break;
case ERROR:
echo "<b>ERROR</b> [$errno] $errstr<br>\n";
break;
case WARNING:
echo "<b>WARNING</b> [$errno] $errstr<br>\n";
break;
default:
echo "Unkown error type: [$errno] $errstr<br>\n";
break;
}
}
?>
------------------end code--------------
------------------------------------------------------------------------
[2002-08-27 22:54:13] sniper@php.net
I guess you meant set_error_handler(). Can you please provide a short
example script that doesn't work as documented?
------------------------------------------------------------------------
[2002-08-27 22:49:02] undreamdev@hotmail.com
The docs say that _set_error_reporting can accept an array of object
reference/method. I believe this is incorrect. This function (in 4.2.2
at least)
does not accept this.
Stephen
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19136&edit=1