Calling set_error_handler to define a class method to handle error

643 views Asked by At

So I've been through stackoverflow once or about a billion times trying to find the answer to my problem but ive been unsuccessful so far. He're the problem. I'm calling a method of an error handling class using trigger_error. for whatever reason the error triggers without calling the function ive defined. please help. here's my code

class runtime_errors
{
    public function __construct()
    {
        //  Calling required files
        include_once(ROOT."/inc/php/pac/browser_detect.php");
        include_once(ROOT."/inc/php/func/display_as.php");

        //  Setting needed class functions
        $this->browser      =   new BrowserDetection();
        $this->display_as   =   new display_as();

        //  if available we're going to set the query string
        if(isset($_SERVER['QUERY_STRING']))
            $this->query_string = $_SERVER['QUERY_STRING'];
        else
            $this->query_string = NULL;


        //  Setting this class and function as the error_handler, the & is important
        set_error_handler(array(&$this, 'log_error'));
    }

    public function log_error($errno, $errstr, $errfile, $errline)
    {
        echo 'am i working?';
    }
}
0

There are 0 answers