Commit 7a5be75e authored by Nigel McNie's avatar Nigel McNie
Browse files

More safety when errors occur early on, like when config sanity is being...

More safety when errors occur early on, like when config sanity is being checked. Prevents ugly warnings and a fatal error if dataroot isn't defined.
parent c4fd3087
......@@ -82,7 +82,7 @@ class Session {
private function __construct() {
// Resume an existing session if required
if (isset($_COOKIE[session_name()])) {
session_start();
@session_start();
}
}
......
......@@ -117,8 +117,8 @@ function log_environ ($message, $escape=true, $backtrace=true) {
* @access private
*/
function log_message ($message, $loglevel, $escape, $backtrace, $file=null, $line=null, $trace=null) {
global $SESSION;
if (!$SESSION && function_exists('get_config')) {
global $SESSION, $CFG;
if (!$SESSION && function_exists('get_config') && $CFG) {
require_once(get_config('docroot') . 'auth/lib.php');
$SESSION = Session::singleton();
}
......
......@@ -498,7 +498,7 @@ function load_config() {
*/
function get_config($key) {
global $CFG;
if (array_key_exists($key,$CFG)) {
if (isset($CFG->$key)) {
return $CFG->$key;
}
return null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment