class and error handling

From: Date: Thu, 16 May 2002 05:52:24 +0000
Subject: class and error handling
Groups: php.general 
Request: Send a blank email to php-general+get-97873@lists.php.net to get a copy of this message
2 things that are foriegn to me. Im trying to construct a class to handle errors. I started out trying to make it recognise errors in the first place and then expand, but Im having difficulty. class.php <?php class eh { function eh() {
       error_reporting (E_ERROR | E_WARNING | E_PARSE);
       set_error_handler($this->errorhandler);
} function errorhandler($type, $str, $file, $line) {
       switch ($type)
       {
           case E_ERROR:
           echo 'ERROR OCCURED';
           break;
           case E_WARNING:
           echo 'YOUR WARNING!';
           break;
       }
} } ?> ----------------------------------------------------------- test.php <?php require_once('./class.php'); $eh = new eh(); join (':', $next); ?> Whenever I run test.php, I get the regular php error page instead 'ERROR OCCURED'. Im not sure if I can feed set_error_handler the way I did. Does anyone see anything wrong with this piece of code? Thanks

« previous php.general (#97873) next »