|
@@ -1,5 +1,19 @@
|
|
|
<?php
|
|
|
umask(0077);
|
|
|
+
|
|
|
+set_error_handler(function ($level, $message, $file = '', $line = 0) {
|
|
|
+ throw new ErrorException($message, 0, $level, $file, $line);
|
|
|
+});
|
|
|
+set_exception_handler(function ($e) {
|
|
|
+ error_log($e);
|
|
|
+ http_response_code(500);
|
|
|
+ echo '<h1>Error</h1>An error occured.';
|
|
|
+});
|
|
|
+register_shutdown_function(function () { // Also catch fatal errors
|
|
|
+ if (($error = error_get_last()) !== NULL)
|
|
|
+ throw new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
|
|
|
+});
|
|
|
+
|
|
|
const ROOT_PATH = __DIR__;
|
|
|
define('CONF', parse_ini_file(ROOT_PATH . '/config.ini', true, INI_SCANNER_TYPED));
|
|
|
|