Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix GH-7759: Incorrect return types for hash() and hash_hmac()
This commit is contained in:
Christoph M. Becker 2021-12-12 15:46:42 +01:00
commit a708db9c8a
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6
4 changed files with 17 additions and 8 deletions

4
NEWS
View File

@ -12,6 +12,10 @@ PHP NEWS
. Fixed bug #81585 (cached_chunks are not counted to real_size on shutdown).
(cmb)
- Hash:
. Fixed bug GH-7759 (Incorrect return types for hash() and hash_hmac()).
(cmb)
- MBString:
. Fixed bug #81693 (mb_check_encoding(7bit) segfaults). (cmb)

View File

@ -171,9 +171,9 @@ static const func_info_t func_infos[] = {
F1("gmp_sqrtrem", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
F1("gmp_rootrem", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
F1("gmp_gcdext", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_OBJECT),
F1("hash", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash", MAY_BE_STRING),
F1("hash_file", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash_hmac", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash_hmac", MAY_BE_STRING),
F1("hash_hmac_file", MAY_BE_STRING|MAY_BE_FALSE),
F1("hash_init", MAY_BE_OBJECT),
F1("hash_final", MAY_BE_STRING),

View File

@ -3,13 +3,13 @@
/** @generate-class-entries */
/** @refcount 1 */
function hash(string $algo, string $data, bool $binary = false, array $options = []): string|false {}
function hash(string $algo, string $data, bool $binary = false, array $options = []): string {}
/** @refcount 1 */
function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {}
/** @refcount 1 */
function hash_hmac(string $algo, string $data, string $key, bool $binary = false): string|false {}
function hash_hmac(string $algo, string $data, string $key, bool $binary = false): string {}
/** @refcount 1 */
function hash_hmac_file(string $algo, string $data, string $key, bool $binary = false): string|false {}

View File

@ -1,7 +1,7 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: d0ed07f608581a5700a10ec53a817ca788ef9638 */
* Stub hash: 715957cf1785912eed75ce92c2a2708defe1ebd7 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash, 0, 2, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false")
@ -15,14 +15,19 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_file, 0, 2, MAY_BE_STRING|M
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hmac, 0, 3, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
#define arginfo_hash_hmac_file arginfo_hash_hmac
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac_file, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)