Skip to content

Commit

Permalink
Added the id in the serialized user
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Jul 10, 2012
1 parent c3ffc16 commit e1f5b11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

### 1.2.3 (2012-07-10)

* Fixed the serialization of users to include the id

### 1.2.2 (2012-07-10)

* Fixed a bug in the previous fix
Expand Down
11 changes: 9 additions & 2 deletions Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public function serialize()
$this->locked,
$this->credentialsExpired,
$this->enabled,
$this->id,
));
}

Expand All @@ -220,6 +221,11 @@ public function serialize()
*/
public function unserialize($serialized)
{
$data = unserialize($serialized);
// add a few extra elements in the array to ensure that we have enough keys when unserializing
// older data which does not include all properties.
$data = array_merge($data, array_fill(0, 2, null));

list(
$this->password,
$this->salt,
Expand All @@ -228,8 +234,9 @@ public function unserialize($serialized)
$this->expired,
$this->locked,
$this->credentialsExpired,
$this->enabled
) = unserialize($serialized);
$this->enabled,
$this->id
) = $data;
}

/**
Expand Down

0 comments on commit e1f5b11

Please sign in to comment.