Moodle
  1. Moodle
  2. MDL-33734

Odd code in sessionlib.php handler_write function

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.3, 2.3
    • Fix Version/s: 2.4
    • Component/s: Other
    • Labels:
    • Rank:
      41766

      Description

      Whilst looking through the file sessionlib.php in function 'handler_write' to track down a crash during backup, I came across the following lines of code:
      if (isset($this->record->id)) {
      $record = new stdClass();
      $record->state = 0;
      $record->sid = $sid; // might be regenerating sid
      $this->record->sessdata = base64_encode($session_data); // there might be some binary mess
      $this->record->userid = $userid;
      $this->record->timemodified = time();
      $this->record->lastip = getremoteaddr();

      The $record variable does not appear to be referenced again in this function, which means that the 'state' and 'sid' values don't seem to be doing anything. This may not be a problem (as the session handling seems to be working), but I thought it worth flagging up, in case something had been missed.

        Activity

        Hide
        Petr Škoda added a comment -

        thanks for the report, I will diagnose it once I get to session drivers again in 2.4dev

        petr

        Show
        Petr Škoda added a comment - thanks for the report, I will diagnose it once I get to session drivers again in 2.4dev petr
        Hide
        Petr Škoda added a comment -

        Thanks a lot for the report, I agree the $record there is useless.

        Show
        Petr Škoda added a comment - Thanks a lot for the report, I agree the $record there is useless.
        Hide
        Dan Poltawski added a comment -

        Integrated, thanks

        Show
        Dan Poltawski added a comment - Integrated, thanks
        Hide
        Dan Poltawski added a comment -

        Code reviewed.

        Show
        Dan Poltawski added a comment - Code reviewed.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility!

        Many thanks for your collaboration, yay!

        Closing, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - For the good and the bad... this is now part of Moodle and people around the world will start using it immediately, what a responsibility! Many thanks for your collaboration, yay! Closing, ciao

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: