Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 3c27b3c

Browse files
committed
Cast null password to string before passing to password_verify
Fails under strict_types otherwise!
1 parent f5a346d commit 3c27b3c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/UserRepository/Htpasswd.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ public function authenticate(string $credential, string $password = null) : ?Use
6161
}
6262
fclose($handle);
6363

64-
return $found && password_verify($password, $hash) ?
65-
$this->generateUser($credential) :
66-
null;
64+
return $found
65+
&& password_verify($password === null ? '' : $password, $hash)
66+
? $this->generateUser($credential)
67+
: null;
6768
}
6869

6970
/**

0 commit comments

Comments
 (0)