Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e4cf49

Browse files
dbrekelmanschalasr
authored andcommitted
[Security] Check UserInterface::getPassword is not null before calling needsRehash
1 parent 70dec3c commit 8e4cf49

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Security/Core/Encoder/UserPasswordEncoder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public function isPasswordValid(UserInterface $user, $raw)
5656
*/
5757
public function needsRehash(UserInterface $user): bool
5858
{
59+
if (null === $user->getPassword()) {
60+
return false;
61+
}
62+
5963
$encoder = $this->encoderFactory->getEncoder($user);
6064

6165
return method_exists($encoder, 'needsRehash') && $encoder->needsRehash($user->getPassword());

0 commit comments

Comments
 (0)