You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symfony version(s) affected: 5.3.2 (probably since 5.3.0)
Description
When using the UserPasswordHasherInterface with a User implementing the PasswordAuthenticatedUserInterface, but not the UserInterface you might run into the following error:
Attempted to call an undefined method named "getSalt" of class "<your user class>"
How to reproduce
Create a user implementing the PasswordAuthenticatedUserInterface:
@wouterj is it expected that PasswordAuthenticatedUserInterface does not extend UserInterface ? this seems weird to me. The name of the interface makes me think that a PasswordAuthenticatedUserInterface is always expected to be a UserInterface
@stof Yes it is expected (I’m the author here) and I think it’s fine as is. PasswordAuthenticatedUserInterface could even be moved to password-hasher at some point.
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 5.3.2 (probably since 5.3.0)
Description
When using the
UserPasswordHasherInterface
with a User implementing thePasswordAuthenticatedUserInterface
, but not theUserInterface
you might run into the following error:How to reproduce
Create a user implementing the
PasswordAuthenticatedUserInterface
:Create a new user and call the password hasher:
Actual Behavior
Fails at UserPasswordHasher#L46, because
getSalt()
does not existExpected Behavior
getSalt()
should not be called, when the method is not provided.Possible Solution
Use
method_exists($user, 'getSalt')
before calling the method.The text was updated successfully, but these errors were encountered: