How can I catch ALL errors in PHP? -
i've found lot of attempts @ all-inclusive error handling implementations, , figured might write wiki-style provide complete solution came with.
the question is:
"how might 1 catch, handle, or intercept error types in php?"
now - might deemed 'rewrite' - don't know there's been comprehensive solution proposed.
there 3 kinds of error handlers need:
set_exception_handler, catch otherwise uncaught exceptions.set_error_handlercatch "standard" php errors. first check againsterror_reportingsee if it's error should handled or ignored (i ignore notices - bad that's choice), , throwerrorexception, letting exception handler catch outputting.register_shutdown_functioncombinederror_get_last. check value of['type']see ife_error,e_parseor fatal error types want catch. these bypassset_error_handler, catching them here lets grab them. again, tend throwerrorexception, errors end being handled same exception handler.
as how implement these, depends entirely on how code set up. ob_end_clean() purge output, , present nice error page telling them error has been reported.
Comments
Post a Comment