cookie named "MoodleSessionTest" - what is it for ?

cookie named "MoodleSessionTest" - what is it for ?

by Di Juwel -
Number of replies: 6

Hi

what is "MoodleSessionTest" cookie for and from what is it different from the "MoodleSession" cookie ?

Average of ratings: -
In reply to Di Juwel

Re: cookie named "MoodleSessionTest" - what is it for ?

by Di Juwel -

anyone?

In reply to Di Juwel

Re: cookie named "MoodleSessionTest" - what is it for ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, was something used in the past for testing the Moodle session wink

It was removed in MDL-17754 in Moodle 2.0, as far as I can see. For example, you don't get that cookie here.
In reply to Tim Hunt

Re: cookie named "MoodleSessionTest" - what is it for ?

by Danny Wahl -

a test session will still oddly pop up if a user has disabled cookies in their browser and therefore can't log in to moodle.

In reply to Danny Wahl

Re: cookie named "MoodleSessionTest" - what is it for ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

No it won't. There is no mention of that cookie name anywhere in the code since 2.0.

In reply to Tim Hunt

Re: cookie named "MoodleSessionTest" - what is it for ?

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I did that search as well and did not find direct traces of it. But I do remember I used to see that cookie set by Moodle sites, too. IIRC, it (or something similar to it) was used to test that the cookies mechanism actually works, by setting and re-reading the value, or something like that (Petr Škoda might remember details). May it be that you have the $CFG->sessioncookie set to 'Test' for some reason? In that case, the following code $sessionname = 'MoodleSession'.$CFG->sessioncookie; could still lead to setting it, but I admit it's not very probable.

In reply to Tim Hunt

Re: cookie named "MoodleSessionTest" - what is it for ?

by Danny Wahl -
You are right Tim and David, I missed the "cookie" part somehow (I blame lack of coffee).  What I was referring to was the new test session, which probably replaced that cookie (total guess):



it's an optional param on the login which is used to verify that sessions are working.
https://github.com/moodle/moodle/blob/master/login/index.php#L38
https://github.com/moodle/moodle/blob/master/login/index.php#L57-L72