Have a look at this page

http://www.php.net/manual/en/function.set-error-handler.php

and at the user comments dated: "09-Sep-2001 03:16" and "01-Mar-2002 11:52"

these might help you

Martin


-----Original Message-----
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 16, 2002 3:52 PM
To: PHP
Subject: [PHP] class and error handling


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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to