error reporting problem[solved]
Posted: Fri Feb 23, 2007 5:28 am
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?
received error on screen
the error handler
received error on screen
Code: Select all
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 45Code: Select all
//define error handler
function myErrorHandler($errno, $errstr, $errfile, $errline){
echo "<h4>my error handler called</h4>; errno: $errno; errstr: $errstr";
echo "<br />current run type: " . CurrentRunType;
$msg = "
<div style = 'text-align:center;'>
<h3>www.thisisraghavan.com</h3>
I am aware of this error and I will fix this soon.
I appreciate your co-operation
</div>";
switch ( TRUE ) {
case ( $errno == E_USER_ERROR || $errno == 1 ):{
if( CurrentRunType == 'test' ){
echo "<b>My ERROR</b> [$errno] $errstr<br />\n";
echo " Fatal error on line $errline in file $errfile";
echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
echo "Aborting...<br />\n";
}else{
echo $msg;
}
exit(1);
break;
}
case ( $errno == E_USER_WARNING || $errno == 2 ):{
if( CurrentRunType == 'test' ){
echo "<b>My WARNING</b> [$errno] $errstr<br />\n";
}
break;
}
case ( $errno == E_USER_NOTICE || $errno == 8 ):{
if( CurrentRunType == 'test' ){
echo "<b>My NOTICE</b> [$errno] $errstr<br />\n";
}
break;
}
default:{
if( CurrentRunType == 'test' ){
echo "Unknown error type: [$errno] $errstr<br />\n";
}
break;
}
}
/* Don't execute PHP internal error handler */
return true;
}