php-src icon indicating copy to clipboard operation
php-src copied to clipboard

Incorrect return types for hash() and hash_hmac()

Open jlherren opened this issue 4 years ago • 1 comments

Description

I believe the stub file entries for hash() and hash_hmac() to be incorrect. Their return types are both specified as string|false, but starting with PHP 8.0 they in fact never return false, they throw a fatal error where they returned false before PHP 8.0. In the case of hash() the only two RETURN_FALSE statements (1, 2) are within if (isfilename)blocks, e.g. the code path used exclusively by hash_file(). It's similar for hash_hmac().

Does that make sense or did I miss something?

PHP Version

PHP >= 8.0

Operating System

All OSes

jlherren avatar Dec 11 '21 16:12 jlherren

Good catch! Thank you!

cmb69 avatar Dec 11 '21 18:12 cmb69