10000 [Security] fixed a fatal error when upgrading from 4.2 · symfony/symfony@dbab46f · GitHub
[go: up one dir, main page]

Skip to content

Commit dbab46f

Browse files
committed
[Security] fixed a fatal error when upgrading from 4.2
1 parent 7f43878 commit dbab46f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ public function serialize()
200200
public function __unserialize(array $data): void
201201
{
202202
[$this->user, $this->authenticated, $this->roles, $this->attributes, $this->roleNames] = $data;
203+
204+
// migration path from 4.2 to 4.3; to be removed in 5.0
205+
if (null === $this->roleNames) {
206+
$this->roleNames = [];
207+
foreach ($this->roles as $role) {
208+
$this->roleNames[] = (string) $role;
209+
}
210+
}
203211
}
204212

205213
/**

0 commit comments

Comments
 (0)
0