I created a custom error handler for php and set it to be my error handler but I still get fatal errors displayed, how do I stop it?
-
My php script still displays fatal error when I make a call to an unknown function, so as to test the error handler but I get fatal error still displayed. I have used the set_error_handler function to set my error handler function but still fatal errors are displayed.
-
Answer:
There are several levels of errors that you must handle: common errors, fatal errors and uncaught exceptions. Combining these three functions you can set your own error handler for every on of them: set_error_handler(); set_exception_handler(); register_shutdown_function(); The trick to caught the fatal error is to register your own shutdown function and inside of it to check if the shutdown was triggered by an error. Here is an example how to do that: function handle_fatal_error() { $error = error_get_last(); if(isset($error['type']) && $error['type']!='') { // your own code...inside $error array you have all the details } }
Sven Al Hamad at Quora Visit the source
Related Q & A:
- How can I stop a player in chess from freezing my game when I am winning in the middle or at the end of a game?Best solution by chess.com
- Can I still get into a Pharmacy School after getting a Bachelor of Science in Chemical Engineering?Best solution by Yahoo! Answers
- Would I still get unemployment checks if I go to school for 6hrs a week?Best solution by Yahoo! Answers
- Can I still get braces after having had a root canal?Best solution by wiki.answers.com
- Whenever I get a runny nose, I bleed from my nose. How can I stop this?Best solution by healthtap.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.