8000 bug #51511 [PasswordHasher] Avoid passing `null` to `hash_pbkdf2()` (… · symfony/symfony@fcb754a · GitHub
[go: up one dir, main page]

Skip to content

Commit fcb754a

Browse files
committed
bug #51511 [PasswordHasher] Avoid passing null to hash_pbkdf2() (sdespont)
This PR was submitted for the 6.4 branch but it was merged into the 5.4 branch instead. Discussion ---------- [PasswordHasher] Avoid passing `null` to `hash_pbkdf2()` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Because https://www.php.net/manual/en/function.hash-pbkdf2.php is expecting `string` and not `?string`. Pertmits avoiding deprecation warning. Commits ------- aaf507a Update Pbkdf2PasswordHasher.php
2 parents bfb57aa + aaf507a commit fcb754a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/PasswordHasher/Hasher/Pbkdf2PasswordHasher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function hash(string $plainPassword, string $salt = null): string
6969
throw new LogicException(sprintf('The algorithm "%s" is not supported.', $this->algorithm));
7070
}
7171

72-
$digest = hash_pbkdf2($this->algorithm, $plainPassword, $salt, $this->iterations, $this->length, true);
72+
$digest = hash_pbkdf2($this->algorithm, $plainPassword, $salt ?? '', $this->iterations, $this->length, true);
7373

7474
return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest);
7575
}

0 commit comments

Comments
 (0)
0