Skip to content

Commit

Permalink
MDL-23949 fixed use of invalid $USER before linked to session
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 26, 2010
1 parent 3e359a0 commit 492a55e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/sessionlib.php
Expand Up @@ -758,13 +758,12 @@ function session_gc() {
* @return string
*/
function sesskey() {
global $USER;

if (empty($USER->sesskey)) {
$USER->sesskey = random_string(10);
// note: do not use $USER because it may not be initialised yet
if (empty($_SESSION['USER']->sesskey)) {
$_SESSION['USER']->sesskey = random_string(10);
}

return $USER->sesskey;
return $_SESSION['USER']->sesskey;
}


Expand Down

0 comments on commit 492a55e

Please sign in to comment.