From 106639b209d0f8b0946394a1108acc9cc20e2216 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Tue, 17 Aug 2021 13:01:12 +0200 Subject: [PATCH] [Security] Fix wrong cache directive when using the new PUBLIC_ACCESS attribute --- Hasher/UserPasswordHasher.php | 2 +- Tests/Hasher/UserPasswordHasherTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Hasher/UserPasswordHasher.php b/Hasher/UserPasswordHasher.php index 4ec8a1b..dcc65e9 100644 --- a/Hasher/UserPasswordHasher.php +++ b/Hasher/UserPasswordHasher.php @@ -50,7 +50,7 @@ public function hashPassword($user, string $plainPassword): string } elseif ($user instanceof UserInterface) { $salt = $user->getSalt(); - if (null !== $salt) { + if ($salt) { trigger_deprecation('symfony/password-hasher', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user)); } } diff --git a/Tests/Hasher/UserPasswordHasherTest.php b/Tests/Hasher/UserPasswordHasherTest.php index b483864..32805b1 100644 --- a/Tests/Hasher/UserPasswordHasherTest.php +++ b/Tests/Hasher/UserPasswordHasherTest.php @@ -158,7 +158,7 @@ public function testNeedsRehash() $passwordHasher = new UserPasswordHasher($mockPasswordHasherFactory); - \Closure::bind(function () use ($passwordHasher) { $this->password = $passwordHasher->hashPassword($this, 'foo', 'salt'); }, $user, User::class)(); + \Closure::bind(function () use ($passwordHasher) { $this->password = $passwordHasher->hashPassword($this, 'foo', 'salt'); }, $user, class_exists(User::class) ? User::class : InMemoryUser::class)(); $this->assertFalse($passwordHasher->needsRehash($user)); $this->assertTrue($passwordHasher->needsRehash($user)); $this->assertFalse($passwordHasher->needsRehash($user));