[CORE] Fix logging of very early failures

This commit is contained in:
Alexei Sorokin 2019-09-13 12:11:43 +03:00 committed by Diogo Peralta Cordeiro
parent cfc93bacbb
commit ffef85414e
2 changed files with 6 additions and 2 deletions

View File

@ -1417,14 +1417,14 @@ function common_path($relative, $ssl=false, $addSession=true)
} elseif (common_config('site', 'server')) {
$serverpart = common_config('site', 'server');
} else {
common_log(LOG_ERR, 'Site server not configured, unable to determine site name.');
throw new ServerException('Site server not configured, unable to determine site name.');
}
} else {
$proto = 'http';
if (common_config('site', 'server')) {
$serverpart = common_config('site', 'server');
} else {
common_log(LOG_ERR, 'Site server not configured, unable to determine site name.');
throw new ServerException('Site server not configured, unable to determine site name.');
}
}
@ -2151,6 +2151,9 @@ function common_negotiate_type($cprefs, $sprefs)
function common_config($main, $sub=null)
{
global $config;
if (is_null($config)) {
throw new ServerException('common_config was invoked before config.php was read');
}
if (is_null($sub)) {
// Return the config category array
return array_key_exists($main, $config) ? $config[$main] : [];

View File

@ -156,6 +156,7 @@ function handleError($error)
} catch (Exception $e) {
// TRANS: Error message.
echo _('An error occurred.');
error_log('Uncaught Exception: ' . $error);
exit(-1);
}
exit(-1);