diff --git a/:q b/:q new file mode 100644 index 00000000..1423a79e --- /dev/null +++ b/:q @@ -0,0 +1,9 @@ + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# On branch installfix +# Changes to be committed: +# modified: install.php +This prevents a crash due to instance-config.php not existing, it will now check if the file exists and if not creates the file + + diff --git a/inc/functions.php b/inc/functions.php index ff5d51df..759e6529 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -26,7 +26,7 @@ if (!extension_loaded('gettext')) { // the user is not currently logged in as a moderator $mod = false; -register_shutdown_function('fatal_error_handler'); +register_shutdown_function('error'); mb_internal_encoding('UTF-8'); loadConfig(); @@ -53,7 +53,7 @@ $current_locale = 'en'; function loadConfig() { global $board, $config, $__ip, $debug, $__version, $microtime_start, $current_locale, $events; - $error = function_exists('error') ? 'error' : 'basic_error_function_because_the_other_isnt_loaded_yet'; + $error = function_exists('error') ? 'error' : 'error'; $boardsuffix = isset($board['uri']) ? $board['uri'] : ''; @@ -271,7 +271,7 @@ function loadConfig() { $_SERVER['REMOTE_ADDR'] = $m[2]; if ($config['verbose_errors']) { - set_error_handler('verbose_error_handler'); + set_error_handler('error'); error_reporting(E_ALL); ini_set('display_errors', true); ini_set('html_errors', false); @@ -332,36 +332,6 @@ function loadConfig() { } } -function basic_error_function_because_the_other_isnt_loaded_yet($message, $priority = true) { - global $config; - - if ($config['syslog'] && $priority !== false) { - // Use LOG_NOTICE instead of LOG_ERR or LOG_WARNING because most error message are not significant. - _syslog($priority !== true ? $priority : LOG_NOTICE, $message); - } - - // Yes, this is horrible. - die('Error' . - '' . - '

Error

' . $message . '
' . - '

This alternative error page is being displayed because the other couldn\'t be found or hasn\'t loaded yet.

'); -} - -function fatal_error_handler() { - if ($error = error_get_last()) { - if ($error['type'] == E_ERROR) { - if (function_exists('error')) { - error('Caught fatal error: ' . $error['message'] . ' in ' . $error['file'] . ' on line ' . $error['line'], LOG_ERR); - } else { - basic_error_function_because_the_other_isnt_loaded_yet('Caught fatal error: ' . $error['message'] . ' in ' . $error['file'] . ' on line ' . $error['line'], LOG_ERR); - } - } - } -} function _syslog($priority, $message) { if (isset($_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'])) { @@ -372,16 +342,6 @@ function _syslog($priority, $message) { } } -function verbose_error_handler($errno, $errstr, $errfile, $errline) { - if (error_reporting() == 0) - return false; // Looks like this warning was suppressed by the @ operator. - error(utf8tohtml($errstr), true, array( - 'file' => $errfile . ':' . $errline, - 'errno' => $errno, - 'error' => $errstr, - 'backtrace' => array_slice(debug_backtrace(), 1) - )); -} function define_groups() { global $config; diff --git a/post.php b/post.php index 99ef4850..0022f178 100644 --- a/post.php +++ b/post.php @@ -325,7 +325,7 @@ if (isset($_POST['delete'])) { $post['file_tmp'] = tempnam($config['tmp'], 'url'); function unlink_tmp_file($file) { @unlink($file); - fatal_error_handler(); + error(); } register_shutdown_function('unlink_tmp_file', $post['file_tmp']);