mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-13623 fixed regression in PHP < 5.2.0; merged from MOODLE_19_STABLE
This commit is contained in:
parent
77b4ca5f93
commit
748923a045
@ -2057,7 +2057,12 @@ function require_logout() {
|
||||
error_log('MoodleSessionTest cookie could not be set in moodlelib.php:'.__LINE__);
|
||||
error_log('Headers were already sent in file: '.$file.' on line '.$line);
|
||||
} else {
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
if (function_exists('array_fill_keys')) {
|
||||
//PHP 5.2.0
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
} else {
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure);
|
||||
}
|
||||
}
|
||||
|
||||
unset($_SESSION['USER']);
|
||||
@ -7751,8 +7756,14 @@ function report_session_error() {
|
||||
moodle_setlocale();
|
||||
|
||||
//clear session cookies
|
||||
setcookie('MoodleSession'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
if (function_exists('array_fill_keys')) {
|
||||
//PHP 5.2.0
|
||||
setcookie('MoodleSession'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
} else {
|
||||
setcookie('MoodleSession'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure);
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath, '', $CFG->cookiesecure);
|
||||
}
|
||||
//increment database error counters
|
||||
if (isset($CFG->session_error_counter)) {
|
||||
set_config('session_error_counter', 1 + $CFG->session_error_counter);
|
||||
|
@ -517,7 +517,12 @@ global $HTTPSPAGEREQUIRED;
|
||||
|
||||
if (empty($nomoodlecookie)) {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
session_set_cookie_params(0, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
if (function_exists('array_fill_keys')) {
|
||||
//PHP 5.2.0
|
||||
session_set_cookie_params(0, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
} else {
|
||||
session_set_cookie_params(0, $CFG->sessioncookiepath, '', $CFG->cookiesecure);
|
||||
}
|
||||
@session_start();
|
||||
if (! isset($_SESSION['SESSION'])) {
|
||||
$_SESSION['SESSION'] = new object;
|
||||
@ -525,7 +530,12 @@ global $HTTPSPAGEREQUIRED;
|
||||
if (!empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) {
|
||||
$_SESSION['SESSION']->has_timed_out = true;
|
||||
}
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
if (function_exists('array_fill_keys')) {
|
||||
//PHP 5.2.0
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
} else {
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, $CFG->sessioncookiepath, '', $CFG->cookiesecure);
|
||||
}
|
||||
$_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test;
|
||||
}
|
||||
if (! isset($_SESSION['USER'])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user