diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php index f8f05a1ed8..b30d136821 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php @@ -199,7 +199,15 @@ abstract class AbstractToken implements TokenInterface */ public function __unserialize(array $data): void { - [$this->user, $this->authenticated, $this->roles, $this->attributes, $this->roleNames] = $data; + [$this->user, $this->authenticated, $this->roles, $this->attributes] = $data; + + // migration path to 4.3+ + if (null === $this->roleNames = $data[4] ?? null) { + $this->roleNames = []; + foreach ($this->roles as $role) { + $this->roleNames[] = (string) $role; + } + } } /**