git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1ba7844
)
page: catch fatal php errors
author
Mischa POSLAWSKY
<perl@shiar.org>
Wed, 13 Sep 2017 23:40:30 +0000
(
01:40
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 18 Sep 2017 18:21:28 +0000
(20:21 +0200)
page.php
patch
|
blob
|
history
diff --git
a/page.php
b/page.php
index 856a08a55f15dec44e4fb486cb4643689d6d5574..4944467684b1673e46060a2dba4094410c6c1634 100644
(file)
--- a/
page.php
+++ b/
page.php
@@
-2,12
+2,20
@@
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
-set_exception_handler(function ($error) {
+function fail($error)
+{
http_response_code(500);
include_once 'page.inc.php';
ob_start();
require_once './500.html';
print str_replace('[[debug]]', $error, ob_get_clean());
http_response_code(500);
include_once 'page.inc.php';
ob_start();
require_once './500.html';
print str_replace('[[debug]]', $error, ob_get_clean());
+}
+set_exception_handler('fail');
+register_shutdown_function(function () {
+ # display failure page for fatal exceptions
+ $error = error_get_last();
+ if (!($error['type'] & (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR))) return;
+ fail("Fatal: $error[message] in $error[file]:$error[line]");
});
include_once 'auth.inc.php';
});
include_once 'auth.inc.php';