Skip to content

Commit

Permalink
Backport serialization fix submitted by Michael Schlueter to maintain…
Browse files Browse the repository at this point in the history
…a version.

See maintaina-com#10
  • Loading branch information
ralflang committed Jan 11, 2024
1 parent a5ed42b commit f6167e5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/Attendee.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,24 +231,32 @@ public function toJson()
*/
public function serialize()
{
return serialize(array(
return array_shift($this->__serialize());
}
public function __serialize(): array
{
return [
'u' => $this->user,
'e' => $this->email,
'p' => $this->role,
'r' => $this->response,
'n' => $this->name,
));
];
}

/**
*/
public function unserialize($data)
{
$data = @unserialize($data);
$this->__unserialize([$data]);

}
public function __unserialize(array $data): void
{
$this->user = $data['u'];
$this->email = $data['e'];
$this->role = $data['p'];
$this->response = $data['r'];
$this->name = $data['n'];
}
}
}

0 comments on commit f6167e5

Please sign in to comment.