PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have an error handler, i do not receive fatal error calls to this function. Here, I intentionally mispell an object and try to call a method that belongs to the object. i get the notice error in handler but not the fatal error. Any ideas?
my error handler called
; errno: 8; errstr: Undefined variable: TemplateManager
current run type: production
Fatal error: Call to a member function getUnit() on a non-object in /home/thisisra/public_html/home/controllers/PW_C_AboutMe.php on line 45
This is either because your error handler was not loaded before the error occured, or more likely that this error causes an immediate exit with no further code execution, so its not possible to catch.
raghavan20 wrote:Fatal error: Call to a member function getUnit() on a non-object in
http://de2.php.net/set_error_handler wrote:The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
raghavan20 wrote:Fatal error: Call to a member function getUnit() on a non-object in
http://de2.php.net/set_error_handler wrote:The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
"Fatal error" means E_ERROR.
that explains a lot. but if you cannot handle E_ERROR, then this is not going to be of much use as we cannot perform any error related operations or mailing, so the only chance of debugging would be looking at the error log.
If you are using PHP 5 you should look into using exceptions, it might help you out. As for fatal errors, these are typically things that happen in development, not usually things that crop up later while the app is under use (assuming that your app is well written). Fatal errors are things like compile errors and other blatant things such as missing semicolons or in your case trying to access a method on something that isn't an object.