-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathErrorHandler.class.php
More file actions
41 lines (35 loc) · 1.03 KB
/
ErrorHandler.class.php
File metadata and controls
41 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
class ErrorHandler
{
public function __construct()
{
set_error_handler(array($this, "errorHandler"));
}
public function errorHandler($errno, $errstr, $errfile, $errline)
{
/*
if(!(error_reporting() & $errno)) {
return;
}
*/
switch ($errno) {
case E_USER_ERROR:
echo "<b>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";
exit(1);
break;
case E_USER_WARNING:
echo "<b>WARNING</b> [$errno] $errstr<br />\n";
break;
case E_USER_NOTICE:
echo "<b>NOTICE</b> [$errno] $errstr<br />\n";
break;
default:
echo "<b>UNKNOWN ERROR</b> [$errno] $errstr<br />\n";
break;
}
return true;
}
}