Jump to content

Destramic

Members
  • Posts

    969
  • Joined

  • Last visited

Posts posted by Destramic

  1. yeah i've used mine to catch exceptions also...although i do like the redirect to 500 error page if occurs...the problem is with my code is that when i try to get the last error

    print_r(error_get_last());
    

    it returns nothing even when there's a error....any idea why?

  2. hey guys i read about being able to catch E_ERROR's using:

    register_shutdown_function('fatal_error_catcher');
    
    function fatal_error_catcher()
    {
            $last_error = error_get_last();
            
            if ($last_error['type'] === E_ERROR) 
            {
                print_r($last_error);
            }
    }
    

    now I've tried to test it when triggering but it'll just show a warning message

    trigger_error('test',  E_ERROR);
    

    my questions are

     

    1. is it even possible to catch a fatal error?...as a fatal error would be caused by the PHP engine itself, which makes me think it  wouldn't execute this error catcher?

     

    2. or is it not catching because you can't manual trigger a E_ERROR.

     

    some advise on this would be helpful thank you

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.