Skip to content

Commit

Permalink
Adding a little more checking to the session switching trap code.
Browse files Browse the repository at this point in the history
I 've come across a problem where:

1. You have an "old" (say 1.3.5?) Moodle installation.
2. You are logged in as admin.
3. You suddenly switch to using a 1.5+ codebase with
   the SAME database, WITHOUT LOGGING OUT FIRST.

In this situation, I was presented with a deadlock. I could not do
anything because "my session had expired", and I could not even
log OUT to clear my session. In fact it was just reloading the
"session expired page" all the time.

If it weren't for debug = On which causes a notice in these
circumstances, it would be fracking difficult to understand what
was going on.

With this small addition, you can at least visit your login page
and log in anew, so problem fixed.

I believe this was talked about in the forums lately? Not sure.


(Also merging Martin's theme standard -> standardwhite change)
  • Loading branch information
defacer committed Jun 13, 2005
1 parent 7e9a11e commit 3413766
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class object {};
}

if (!isset($CFG->theme)) {
$CFG->theme = 'standard';
$CFG->theme = 'standardwhite';
}

theme_setup(); // Sets up theme global variables
Expand All @@ -346,7 +346,7 @@ class object {};
if ($SESSION != NULL) {
if (empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) {
report_session_error();
} else if ($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] != $SESSION->session_test) {
} else if (isset($SESSION->session_test) && $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] != $SESSION->session_test) {
report_session_error();
}
}
Expand Down

0 comments on commit 3413766

Please sign in to comment.