class_mcEvent.inc.php
3.94 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?
class mcEvent extends mcReport {
/**
* @var int -- errno, contains the level of the error raised
*/
private $errno;
/**
* @var string -- errstr, contains the error message
*/
private $errstr;
/**
* @var string -- errfile, which contains the filename that the error was raised in
*/
private $errfile;
/**
* @var int -- errline, which contains the line number the error was raised at
*/
private $errline;
/**
* @var array -- errcontext, which is an array that points to the active symbol
* table at the point the error occurred. In other words,
* errcontext will contain an array of every variable that
* existed in the scope the error was triggered in. User error
* handler must not modify error context.
*/
private $errcontext;
private $array_debug_backtrace = null;
private $ErrorFunction = null;
protected function __construct($param_errno, $param_errstr, $param_errfile=null, $param_errline=null, $param_errcontext=null) {
$this->errno = $param_errno;
$this->errstr = $param_errstr;
$this->errcontext = $param_errcontext;
$this->array_debug_backtrace = debug_backtrace();
if($param_errfile == null || $param_errline == null) {
$this->ErrorFunction = $this->array_debug_backtrace[2]["class"].$this->array_debug_backtrace[2]["type"]
.$this->array_debug_backtrace[2]["function"]."(...) :".$this->array_debug_backtrace[1]["line"]."";
$this->errfile = $this->array_debug_backtrace[1]['file'];
$this->errline = $this->array_debug_backtrace[1]['line'];
} else {
$this->errfile = $param_errfile;
$this->errline = $param_errline;
}
}
protected function getTextMessage() {
if(is_null($this->TextMessage)) {
$this->TextMessage = self::mkMessage($this->errno, $this->errstr, $this->errfile, $this->errline, $this->errcontext, mcCONST::CODEOFFSET);
}
return $this->TextMessage;
}
private static function mkMessage($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext, $param_offset) {
$var_message = mcCONST::LINEBREAK.'-------------------------------------------------------------'.mcCONST::LINEBREAK;
if(array_key_exists($param_errno, Error::$ErrorArray)) {
$var_message .= 'Typ:'. mcCONST::TAB. Error::$ErrorArray[$param_errno]. mcCONST::TAB. date('d.m.Y G:i').mcCONST::LINEBREAK;
} else {
$var_message .= 'Typ:'. mcCONST::TAB.$param_errno. mcCONST::TAB. date('d. m. Y G:i').mcCONST::LINEBREAK;
}
$var_message .= 'Notice:'. mcCONST::TAB. $param_errstr.mcCONST::LINEBREAK;
$var_message .= 'File:'. mcCONST::TAB. $param_errfile.' (row: '.$param_errline.')'.mcCONST::LINEBREAK;
// $var_message .= 'Url:'. mcCONST::TAB. urldecode(http_build_query($_GET)).mcCONST::LINEBREAK;
// $var_message .= 'PHP: '. mcCONST::TAB. PHP_VERSION . ' (' . PHP_OS . ')'.mcCONST::LINEBREAK;
// $var_message .= mcCONST::LINEBREAK;
$var_message .= self::getCodeFromRow($param_errfile, $param_errline, $param_offset);
$var_message .= mcCONST::LINEBREAK.$param_errcontext.mcCONST::LINEBREAK;
return $var_message;
}
}
class mcNoticeEvent extends mcEvent {
public static $count =0;
public static function handle($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext) {
self::add(new mcNoticeEvent($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext));
mcNoticeEvent::$count++;
}
}
class mcErrorEvent extends mcEvent {
public static $count =0;
public static function handle($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext) {
self::add(new mcErrorEvent($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext));
mcErrorEvent::$count++;
}
}
class mcXSLErrorEvent extends mcEvent {
public static $count =0;
public static function handle($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext) {
self::add(new mcXSLErrorEvent($param_errno, $param_errstr, $param_errfile, $param_errline, $param_errcontext));
mcXSLErrorEvent::$count++;
}
}