I have come across an annoying problem while writing some PHP4 code. I renamed the method of a class but I forgot to rename it where it was being called from. The annoying part is it was hard to track down where the problem was because no error was triggered. The script simply aborted leaving the web page partially rendered. Is it normal for this not to trigger an error or is there something wacky going on here? If this is normal is there a way to force this kind of thing to cause an error?
A:
Try setting the error_reporting()
at the top of your script, like this:
error_reporting(E_ALL); // report all errors
yjerem
2010-04-15 01:21:07
I will try it. Currently our error handling is set up like this:error_reporting( 0 ); // Turns off all error reporting.$old_error_handler = set_error_handler( "userErrorHandler" );function userErrorHandler ( $errno, $errmsg, $filename, $linenum, $vars ) {//custom error handling code here}What effect does setting error_reporting(0) have when you immediately specify your own error handling code right afterwards? When the missing method is called, the custom error handling function is not called.
INTPnerd
2010-04-15 01:40:59
Thanks that worked. I am still confused about what effect changing the error_reporting() level has when you have a custom error handler and I am wondering if it is safe to enable the E_ALL level for a production server.
INTPnerd
2010-04-15 02:05:18