minor #41567 [Security] Fix SerializableUser fixture (derrabus)

This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Fix SerializableUser fixture

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

That's hopefully the last `Serializable` implementation we need to fix. 😓

Commits
-------

8fbf3bb3c7 [Security] Fix SerializableUser fixture
This commit is contained in:
Nicolas Grekas 2021-06-06 16:13:00 +02:00
commit a850da562b
1 changed files with 12 additions and 2 deletions

View File

@ -322,12 +322,22 @@ class SerializableUser implements UserInterface, \Serializable
public function serialize(): string
{
return serialize($this->name);
return serialize($this->__serialize());
}
public function unserialize($serialized): void
{
$this->name = unserialize($serialized);
$this->__unserialize(unserialize($serialized));
}
public function __serialize(): array
{
return ['name' => $this->name];
}
public function __unserialize(array $data): void
{
['name' => $this->name] = $data;
}
}