Permalink
Browse files

MDL-37060 prevent notice in session_get_instance()

  • Loading branch information...
skodak committed Dec 8, 2012
1 parent 325e266 commit 8c3547554ba14d928460ee6e2d11035a4b1c0b05
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/sessionlib.php
View
@@ -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;
}

0 comments on commit 8c35475

Please sign in to comment.