mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/LoginNotify
synced 2024-09-23 10:20:21 +00:00
build: Add @phan-var to handle varying return value of hash_hmac
Since php8.0 hash_hmac throws exception and does not return false Reported by phan running with php8.1 Change-Id: I2374daf5e0954bef91da65454d973ef3d1eb2183
This commit is contained in:
parent
2f4996cf14
commit
70703bdce3
|
@ -1044,7 +1044,9 @@ class LoginNotify implements LoggerAwareInterface {
|
|||
|
||||
// TODO: would be nice to truncate the hash, but we would need b/c
|
||||
$res = hash_hmac( 'sha1', $username . '|' . $year . $salt, $this->secret );
|
||||
'@phan-var string|false $res';
|
||||
if ( !is_string( $res ) ) {
|
||||
// Throws ValueError under php8 in case of error, remove this when mininum is php8
|
||||
throw new UnexpectedValueException( "Hash failed" );
|
||||
}
|
||||
$encoded = $year . '-' . $salt . '-' . \Wikimedia\base_convert( $res, 16, 36 );
|
||||
|
|
Loading…
Reference in a new issue