File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,36 @@ final public static function GetVFSModules() {
186
186
* @return void
187
187
*/
188
188
final public static function shutdown () {
189
+ if ( !is_null ($ error = error_get_last ()) ) {
190
+ self ::handle ($ error ['type ' ], $ error ['message ' ], $ error ['file ' ], $ error ['line ' ]);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Error handler
196
+ * @access public
197
+ * @return void
198
+ */
199
+ final public static function handle ($ errno , $ errstr , $ errfile , $ errline ) {
200
+ @header_remove ();
201
+
202
+ while ( ob_get_level () ) {
203
+ ob_end_flush ();
204
+ }
205
+
206
+ header ('HTTP/1.0 500 Internal Server Error ' );
207
+ header ('Content-type: text/html ' );
208
+
209
+ print '<html><head></head><body> ' ;
210
+ print '<h1>Error</h1><pre> ' ;
211
+ print print_r ([
212
+ 'message ' => $ errstr ,
213
+ 'type ' => $ errno ,
214
+ 'file ' => $ errfile ,
215
+ 'line ' => $ errline
216
+ ], true );
217
+ print '</pre></body></html> ' ;
218
+ exit ;
189
219
}
190
220
191
221
/**
@@ -216,6 +246,7 @@ final public static function run() {
216
246
}
217
247
218
248
register_shutdown_function ([__CLASS__ , 'shutdown ' ]);
249
+ set_error_handler ([__CLASS__ , 'handle ' ]);
219
250
220
251
define ('DIR_ROOT ' , realpath (__DIR__ . '/../../../../ ' ));
221
252
define ('DIR_SERVER ' , realpath (__DIR__ . '/../../ ' ));
You can’t perform that action at this time.
0 commit comments