PHP Classes

I like the concept of a fatal error handler in the shutdown f...

Recommend this page to a friend!

      Error Logging  >  All threads  >  I like the concept of a fatal error...  >  (Un) Subscribe thread alerts  
Subject:I like the concept of a fatal error...
Summary:Package rating comment
Messages:2
Author:Fabian Schmengler
Date:2010-10-15 16:37:41
Update:2010-10-22 05:55:06
 

Fabian Schmengler rated this package as follows:

Utility: Insufficient
Consistency: Sufficient
Examples: Insufficient

  1. I like the concept of a fatal error...   Reply   Report abuse  
Picture of Fabian Schmengler Fabian Schmengler - 2010-10-15 16:37:41
I like the concept of a fatal error handler in the shutdown function, I implemented something similar a while ago. But your class could need some improvement, please allow me a little review:

- you set error_reporting to 1 (E_ERROR) and later on only check if it is 0. Don't forget that the error_reporting is a bitmask! To check it in a custom error handler use bitwise and. Something like
if ($errNo & error_reporting() == 0) return;

- global constants without namespace prefix could be a problem. Why not make them class constants? Or even better static members, since these are configurable values and not really constants.

- Last but not least: How is this supposed to work at all? Every method is private ;-)

  2. Re: I like the concept of a fatal error...   Reply   Report abuse  
Picture of Nitesh Apte Nitesh Apte - 2010-10-22 05:55:07 - In reply to message 1 from Fabian Schmengler
Thanks for the review and the corrections. That was very helpful as I am not very much experienced in PHP. I am good at finding solutions.

For making this class work, you can either change the access specifier or you can create a single instance of this class.

Thanks again.