-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfatalerror.php
More file actions
162 lines (159 loc) · 6.27 KB
/
fatalerror.php
File metadata and controls
162 lines (159 loc) · 6.27 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
include_once("phperror.php");
class fatalerror extends phperror{
public function __construct($description) {
parent::__construct($description);
}
public function checkerrortype($message) {
if (preg_match('/Cannot use [] for reading/',$message))
{
$this->cannot_use_bracket_for_reading();
}
else if (preg_match('/Class (.*) not found/',$message))
{
preg_match('/Class (.*) not found in/',$message,$class);
$this->class_not_found($class[1]);
}
else if (preg_match('/Interface (.*) not found/',$message))
{
preg_match('/Interface (.*) not found in/',$message,$interface);
$this->interface_not_found($interface[1]);
}
else if (preg_match('/Call to undefined method/',$message))
{
preg_match('/Call to undefined method (.*)\(\) in/',$message,$method);
$this->call_to_undefined_method($method[1]);
}
else if (preg_match('/Call to undefined function/',$message))
{
preg_match('/Call to undefined function (.*)\(\) in/',$message,$function);
$this->call_to_undefined_function($function[1]);
}
else if (preg_match('/Cannot implement/i',$message))
{
preg_match('/Cannot implement (.*) not an interface/i',$message,$interface);
$this->cannot_implement_not_an_interface($interface[1]);
}
else if (preg_match('/Namespace declaration has to be the very first statement/',$message))
{
$this->namespace_declaration_has_to_be_first_statement();
}
else if (preg_match('/Uncaught exception (.*) with message/',$message))
{
$this->uncaught_exception_with_message();
}
else if (preg_match('/Can\'t use function return value/',$message))
{
$this->cant_use_function_return_value();
}
else if (preg_match('/failed to open stream: Permission denied/i',$message))
{
$this->failed_to_open_stream_permission_denied();
}
else if (preg_match('/Can\'t inherit abstract function/',$message))
{
$this->cant_inherit_abstract_function();
}
else if (preg_match('/Object of class (.*) could not be converted to string/',$message))
{
$this->object_of_class_could_not_be_converted_to_string();
}
else if (preg_match('\'continue\' operator accepts only positive numbers/i',$message))
{
$this->continue_operator_accepts_only_positive_numbers();
}
else if (preg_match('/Maximum execution time (.*) exceeded/',$message))
{
$this->maximum_execution_time_exceeded();
}
else if (preg_match('/Allowed memory size (.*) exhausted/',$message))
{
$this->allowed_memory_size_exhausted();
}
else if (preg_match('/Cannot redeclare class/',$message))
{
$this->cannot_redeclare_class();
}
else if (preg_match('/Cannot redeclare (.*)\(\)/',$message))
{
$this->cannot_redeclare_function();
}
}
private function cannot_use_bracket_for_reading() {
$this->explanation = "Die Klammer[] ist leer";
$this->solution[] = "Ein ] entfernen";
$this->solution[] = "[] mit true befüllen";
}
private function class_not_found($classname){
$this->explanation = "Eine Klasse mit der Schreibweise ".$classname." kann nicht gefunden werden";
$this->solution[] = "Nach Klasse mit ähnlicher Schreibweise suchen";
$this->solution[] = "Includes überprüfen";
}
private function interface_not_found($interfacename){
$this->explanation = "Ein Interface mit der Schreibweise ".$interfacename." kann nicht gefunden werden";
$this->solution[] = "Nach Interface mit ähnlicher Schreibweise suchen";
$this->solution[] = "Includes überprüfen";
}
private function call_to_undefined_method($methodname){
$this->explanation = "Eine Methode mit der Schreibweise ".$methodname." kann nicht gefunden werden";
$this->solution[] = "Nach Methode mit ähnlicher Schreibweise suchen";
$this->solution[] = "Includes überprüfen";
}
private function call_to_undefined_function($functionname){
$this->explanation = "Eine Funktion mit der Schreibweise ".$functionname." kann nicht gefunden werden";
$this->solution[] = "Nach Funktion mit ähnlicher Schreibweise suchen";
$this->solution[] = "Includes überprüfen";
}
private function cannot_implement_not_an_interface($interfacename){
$this->explanation = "Ein Interface mit dieser Schreibweise kann nicht gefunden werden";
$this->solution[] = "Nach Interface mit ähnlicher Schreibweise suchen";
$this->solution[] = "Interface vor Klassennamen";
}
private function namespace_declaration_has_to_be_first_statement(){
$this->explanation = "Namespace wird zu spät definiert";
$this->solution[] = "Positionen verschieben";
}
private function uncaught_exception_with_message($exception){
$this->explanation = "Die Fehlermeldung".$exception." wird nirgendwo abgefangen";
$this->solution[] = "try{..}catch(Exception $e){} um den Aufruf";
}
private function cant_use_function_return_value(){
$this->explanation = "Veraltetes Problem";
$this->solution[] = "Auf Version 5.3 updaten";
}
private function failed_to_open_stream_permission_denied(){
$this->explanation = "Fehlende Zugriffsrechte";
$this->solution[] = "Rechte anpassen";
}
private function cant_inherit_abstract_function(){
$this->explanation = "Abstrakte Funktionen werden (anders als in Java) weitergegeben.";
$this->solution[] = "abstract entfernen";
}
private function object_of_class_could_not_be_converted_to_string(){
$this->explanation = "Die Klasse kann nicht als String dargestellt werden";
$this->solution[] = "eventuell \$newvar = classname->xyz()";
}
private function continue_operator_accepts_only_positive_numbers($number){
$this->explanation = $number." ist negativ";
$this->solution[] = "ein abs(".$number.")";
$this->solution[] = "nummer anpassen";
}
private function maximum_execution_time_exceeded(){
$this->explanation = "Maximale ausführungszeit überschritten";
$this->solution[] = "Mögliche endlosschleife entfernen";
$this->solution[] = "Ausführungszeit verlängern";
}
private function allowed_memory_size_exhausted(){
$this->explanation = "Maximale Speichergröße überschritten";
$this->solution[] = "Mögliche endlosschleife entfernen";
$this->solution[] = "Memorysize vergrößern";
}
private function cannot_redeclare_class(){
$this->explanation = "Der Klassenname existiert bereits";
$this->solution[] = "Umbenennen";
}
private function cannot_redeclare_function(){
$this->explanation = "Der Methoden / Funktionenname existiert bereits";
$this->solution[] = "Umbenennen";
}
}