Skip to content

Commit 7740e88

Browse files
fabpotnicolas-grekas
authored andcommitted
[Security] fixed a fatal error when upgrading from 4.2
1 parent 7edf84b commit 7740e88

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Authentication/Token/AbstractToken.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,15 @@ public function serialize()
199199
*/
200200
public function __unserialize(array $data): void
201201
{
202-
[$this->user, $this->authenticated, $this->roles, $this->attributes, $this->roleNames] = $data;
202+
[$this->user, $this->authenticated, $this->roles, $this->attributes] = $data;
203+
204+
// migration path to 4.3+
205+
if (null === $this->roleNames = $data[4] ?? null) {
206+
$this->roleNames = [];
207+
foreach ($this->roles as $role) {
208+
$this->roleNames[] = (string) $role;
209+
}
210+
}
203211
}
204212

205213
/**

0 commit comments

Comments
 (0)