From cd63446f9b42e0284b5e6765e72054840d0c42c3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 21 May 2019 21:22:42 +0200 Subject: [PATCH] [Security] fixed a fatal error when upgrading from 4.2 --- .../Core/Authentication/Token/AbstractToken.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; + } + } } /**