|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-08-27 22:49 UTC] undreamdev at hotmail dot 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 08:00:02 2026 UTC |
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--------------