mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Make sure that hash function returns a string
The documentation says it can return false, and even if that is highly unlikely for sha256, better safe than sorry. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
14f00208e2
commit
df25a6de31
1 changed files with 6 additions and 1 deletions
|
|
@ -191,7 +191,12 @@ abstract class AbstractMapping {
|
|||
* Get the hash to store in database column ldap_dn_hash for a given dn
|
||||
*/
|
||||
protected function getDNHash(string $fdn): string {
|
||||
return (string)hash('sha256', $fdn, false);
|
||||
$hash = hash('sha256', $fdn, false);
|
||||
if (is_string($hash)) {
|
||||
return $hash;
|
||||
} else {
|
||||
throw new \RuntimeException('hash function did not return a string');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue