Skip to content
Snippets Groups Projects
Commit b51ab127 authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

unbreak tests: starting from PHP 7.4, $algo is no longer an int but mixed

parent cfdf56ff
No related branches found
No related tags found
No related merge requests found
...@@ -317,7 +317,7 @@ class Crypto ...@@ -317,7 +317,7 @@ class Crypto
* This function hashes a password with a given algorithm. * This function hashes a password with a given algorithm.
* *
* @param string $password The password to hash. * @param string $password The password to hash.
* @param int $algorithm The algorithm to use. Defaults to the system default * @param mixed $algorithm The algorithm to use. Defaults to the system default
* *
* @return string The hashed password. * @return string The hashed password.
* @throws \InvalidArgumentException If the input parameter is not a string. * @throws \InvalidArgumentException If the input parameter is not a string.
...@@ -328,7 +328,7 @@ class Crypto ...@@ -328,7 +328,7 @@ class Crypto
* @author Dyonisius Visser, TERENA <visser@terena.org> * @author Dyonisius Visser, TERENA <visser@terena.org>
* @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no> * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no>
*/ */
public static function pwHash(string $password, int $algorithm = PASSWORD_DEFAULT): string public static function pwHash(string $password, $algorithm = PASSWORD_DEFAULT): string
{ {
if (!is_string($hash = password_hash($password, $algorithm))) { if (!is_string($hash = password_hash($password, $algorithm))) {
throw new InvalidArgumentException('Error while hashing password.'); throw new InvalidArgumentException('Error while hashing password.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment