Skip to content
  • Petr Skoda's avatar
    MDL-46099 session: fix use of references for session globals · 2e00d01d
    Petr Skoda authored
    This reverses the references used for global $USER and $SESSION,
    the reason is that PHP does not allow references to references.
    $USER is a reference to $GLOBALS['USER'] which means we cannot
    put any references to it. Solution is to store the current user and session
    objects in $GLOBALS['USER'] and $GLOBALS['SESSIOn'] are reference
    them in $_SESSION.
    
    This patch makes the session code behave the same way in CLI,
    phpunit and normal web requests - this allows use to finally
    unit test most aspects of the session code in Moodle.
    2e00d01d