set_error_handler() help

From: Date: Wed, 13 Sep 2000 15:20:11 +0000
Subject: set_error_handler() help
Groups: php.general 
Request: Send a blank email to php-general+get-16585@lists.php.net to get a copy of this message
I've created a cls_error_handler for my system. My problem is, I think, a symantec issue. I took code from PHP manual http://www.zend.com/manual/features.error-handling.php and tried to place the error handler in a class put the test error code stuff in another file. When calling the class from my file I ran into these issues: If myErrorHandler() resides in the same file as my code (NOT a class) I use the line: $oldErrorHandler = set_error_handler("myErrorHandler"); and I get all the info I want - date / time, error num / msg, filename, etc However because I want it to be a class I use these lines to redirect: (assume prior instantiation) $userErrorHandler = $err->myErrorHandler(); $oldErrorHandler = set_error_handler("userErrorHandler"); This works in that it calls the correct class function. (Incidentally, I found that this syntax did not work: $old = set_error_handler("err->userErrorHandler")) Ok....the problem is that the error vars don't appear to be passed. (I use trigger_error($msg, $type)) In the manual example we have a string, $err, being written that uses the vars $dt, $errno, $errortype, $errmsg, $filename, $linenum. I don't know how to populate these values. I've tried making them global in the class but no luck. I tried the above redirection as $userErrorHandler = $err->myErrorHandler($errno, $errmsg, $filename, $linenum, $vars) but that didn't work either. Any ideas what I'm doing wrong? thanks John

« previous php.general (#16585) next »