From 3277509a60f4edbc637e3133d9aa878e283046be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sat, 8 Dec 2012 12:31:05 +0100 Subject: [PATCH] MDL-37060 prevent notice in session_get_instance() --- lib/sessionlib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/sessionlib.php b/lib/sessionlib.php index 123c70e463d..f6529ed520d 100644 --- a/lib/sessionlib.php +++ b/lib/sessionlib.php @@ -41,13 +41,13 @@ function session_get_instance() { static $session = null; - if (!defined('NO_MOODLE_COOKIES')) { - // Moodle session was not initialised yet in lib/setup.php. - $session = new emergency_session(); - return $session; - } - if (is_null($session)) { + if (!defined('NO_MOODLE_COOKIES') or empty($DB)) { + // Moodle was not initialised properly in lib/setup.php. + $session = new emergency_session(); + return $session; + } + if (empty($CFG->sessiontimeout)) { $CFG->sessiontimeout = 7200; }