today we have updated our PHP from 5.5.7 to 5.6.13 and all password hashes from password_hash()
function have stopped working.
Is there any information on why this occurred? What have we done wrong?
When I've used password reset functionality to create new hash of the password it then worked correctly again.
Passwords are stored in MySQL database using varchar(255)
. Class used is Passwords.php
Authentication looks like this:
// Try to find the user from database
$user = $this->getUser($email);
// If the provided password is invalid
if (!isset($user) || !$user->isPasswordValid($password)) {
throw new AuthenticationException('portal.user.signInFailed');
}
And the isPasswordValid method looks like this:
/**
* Validate given User password.
* @param string $value Password to validate
* @return bool
*/
public function isPasswordValid($value)
{
return Passwords::verify($value, $this->password);
}
This is how my hashing function looks like:
/**
* Set and hash new password value.
* @param string $value New password
* @return static
*/
public function setPassword($value)
{
$this->password = Passwords::hash($value);
return $this;
}
This is hash from before update (not working) and after password reset(working)
$2y$10$wMM1rXjwOIJb8Ga0L0mINevOvZxY4C2ebucBDNZ1P1dkp.J22KGzm
$2y$10$cr6HeWoS2MDxK1tbJvaEjefMiex1RgeG/JrHTrVznN2DeBPVJnVC.
I'd rather not give you the password itself :)