From 858c0a0ecdb0d3e07f76e9d57582b35e09515e4d Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sat, 8 May 2021 21:56:05 +0100 Subject: [PATCH] add in some @deprecated notifices --- functions.inc.php | 3 +++ model/PFACrypt.php | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index 5fde48b7..55d66113 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -935,6 +935,7 @@ function validate_password($password) * @param string $pw * @param string $pw_db - encrypted hash * @return string crypt'ed password, should equal $pw_db if $pw matches the original + * @deprecated */ function _pacrypt_md5crypt($pw, $pw_db = '') { @@ -951,6 +952,7 @@ function _pacrypt_md5crypt($pw, $pw_db = '') /** * @todo fix this to not throw an E_NOTICE or deprecate/remove. + * @deprecated */ function _pacrypt_crypt($pw, $pw_db = '') { @@ -1304,6 +1306,7 @@ function pacrypt($pw, $pw_db = "") * @param string $salt (optional) * @param string $magic (optional) * @return string hashed password in crypt format. + * @deprecated see PFACrypt::cryptMd5() (note this returns {MD5} prefix */ function md5crypt($pw, $salt="", $magic="") { diff --git a/model/PFACrypt.php b/model/PFACrypt.php index 8028b4bd..ee9254e1 100644 --- a/model/PFACrypt.php +++ b/model/PFACrypt.php @@ -9,7 +9,7 @@ class PFACrypt $this->algorithm = $algorithm; } - public function hash(string $pw, $pw_db) + public function hash(string $pw, string $pw_db = ''): string { $algorithm = $this->algorithm; @@ -94,7 +94,8 @@ class PFACrypt return '{CRYPT}' . crypt($pw, $pw_db); case 'system': - return _pacrypt_crypt($pw, $pw_db); + return crypt($pw, $pw_db); + case 'cleartext': return $pw; case 'CLEAR':