• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter and PHP Error Handling

#1
[eluser]julietteculver[/eluser]
OK, I'm trying to get my head round exactly how PHP error handling works in CodeIgniter and any help would be much appreciated.

So far my understanding is:

1) you set error_reporting() in your index.php file which overrides anything in your php.ini file

2) An error handler is set in system/codeigniter/CodeIgniter.php using set_error_handler - this error handler, _exception_handler, is found in system/codeigniter/Common.php

3) The _exception_handler function ignores E_STRICT errors, calls the show_php_error function From the Exceptions system library if the severity is that specified by your error_reporting() function in index.php and logs the error according to whatever you have set up in your config.php file

4) The handler returns FALSE so after this PHP goes on to handle the error however it normally would according your error_reporting level and display_errors setting.

The thing that is puzzling me is that E_ERROR errors i.e. fatal errors don't seem to be being caught by _exception_handler at all. It's not just that show_php_error isn't being called, it looks like the function just isn't being called for them. This is obviously a problem as it means that they aren't get handled by show_php_error or logged. For example if I deliberately mistype $this->load->views('foo'); in a controller, the handler doesn't get called.

Anybody got any idea what might be going on here?

Many thanks,
Juliette


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.