I have a custom error handler that's supposed to log errors to a database, but for some reason this error always shows up in the database. Every time a page is loaded "0 in on line 0", where the first 0 is the error level, in whatever file, since it's not provided, on line 0. This is odd because I've never seen this until now. The error handler is below;
public function fatalErrHandlr(){
$errstrArr = error_get_last();
$errno = mysqli_real_escape_string($this->dbc, trim($errstrArr['type']));
$errstr = mysqli_real_escape_string($this->dbc, trim($errstrArr['message']));
$errfile = mysqli_real_escape_string($this->dbc, trim($errstrArr['file']));
$errline = mysqli_real_escape_string($this->dbc, trim($errstrArr['line']));
$query = "INSERT INTO `err` (`errno`, `errstr`, `errfile`, `errline`) VALUES ('$errno', '$errstr', '$errfile', '$errline')";
mysqli_query($this->dbc, $query);
//var_dump(mysqli_error($this->dbc));
echo("<b>There was an error. Check the database.</b>");
//return true;
}
The error handler is configured with:
register_shutdown_function(array($core, 'fatalErrHandlr'));
register_shutdown_function(array($core, 'fatalErrHandlr'));on the index page.