Hi. This is the main part of my errorhandler:
function my_error_handler($errno, $errstr, $errfile, $errline){
$errno = $errno & error_reporting();
if($errno == 0) return;
if(!defined('E_STRICT')) define('E_STRICT', 2048);
if(!defined('E_RECOVERABLE_ERROR')) define('E_RECOVERABLE_ERROR', 4096);
$error = "";
switch($errno){
case E_ERROR: $error = $error."Error"; break;
case E_WARNING: $error = $error."Warning"; break;
case E_PARSE: $error = $error. "Parse Error"; break;
case E_NOTICE: $error = $error. "Notice"; break;
case E_CORE_ERROR: $error = $error. "Core Error"; break;
case E_CORE_WARNING: $error = $error. "Core Warning"; break;
case E_COMPILE_ERROR: $error = $error. "Compile Error"; break;
case E_COMPILE_WARNING: $error = $error. "Compile Warning"; break;
case E_USER_ERROR: $error = $error. "User Error"; break;
case E_USER_WARNING: $error = $error. "User Warning"; break;
case E_USER_NOTICE: $error = $error. "User Notice"; break;
case E_STRICT: $error = $error. "Strict Notice"; break;
case E_RECOVERABLE_ERROR: $error = $error. "Recoverable Error"; break;
default: $error = $error. "Unknown error ($errno)"; break;
}
$error = " <i>$errstr</i> in <b>$errfile</b> on line <b>$errline</b><br /> \n";
$gi = geoip_open("GeoIP/GeoLiteCity.dat",GEOIP_STANDARD);
$ip = ip();
$user = $_SESSION["username"];
$country = geoip_country_name_by_name($gi, $ip);
$error .= "User: <b>".$user."</b> Country: <b>".$country."</b> Ip: <b>".$ip."</b> <br /><br /> \n";
//Bruk ip function og kanskje geoip isteden?
echo "<p>Something went wrong. It has been logged and will be fixed shortly. Thanks </p>";
//echo $error;
log_error_ereg($error);
}
This works fine normally, but if i get a critical error it shows it shows php filename, what went wrong etc. Stuff I want to hide from the user. How do I include this type of errors in my error handler? Seems my error handler doesn't pick does up..