Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-33734

Odd code in sessionlib.php handler_write function

    Details

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

      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.

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

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

          petr

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

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

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

          Integrated, thanks

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

          Code reviewed.

          Show
          poltawski Dan Poltawski added a comment - Code reviewed.
          Hide
          stronk7 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
          stronk7 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:
                Fix Release Date:
                3/Dec/12