diff --git a/lib/setup.php b/lib/setup.php index 364341c1e50..4106b9e9e38 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -308,12 +308,11 @@ $CFG->httpswwwroot = $CFG->wwwroot; if (! isset($_SESSION['SESSION'])) { $_SESSION['SESSION'] = new object; $_SESSION['SESSION']->session_test = random_string(10); - if (empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) { - setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, '/'); - $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test; - } else { - $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = 'error!!'; + if (!empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) { + define('SESSION_HAS_TIMED_OUT', 'true'); } + setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, '/'); + $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test; } if (! isset($_SESSION['USER'])) { $_SESSION['USER'] = new object;