Deprecate mhash constants

The mhash functions already have been deprecated as of PHP 8.1.0[1],
but the respective constants appear to have been missed.  We catch up
on that.

[1] <https://wiki.php.net/rfc/deprecations_php_8_1#mhash_function_family>

Closes GH-16569.
This commit is contained in:
Christoph M. Becker 2024-10-24 15:46:58 +02:00
parent 7c37c25ef2
commit 2b10cd1beb
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
5 changed files with 51 additions and 1 deletions

View file

@ -56,6 +56,11 @@ PHP 8.5 UPGRADE NOTES
4. Deprecated Functionality 4. Deprecated Functionality
======================================== ========================================
- Hash:
The MHASH_* constants have been deprecated. These have been overlooked
when the mhash*() function family has been deprecated per
https://wiki.php.net/rfc/deprecations_php_8_1#mhash_function_family
======================================== ========================================
5. Changed Functions 5. Changed Functions
======================================== ========================================

View file

@ -1189,7 +1189,7 @@ static void mhash_init(INIT_FUNC_ARGS)
} }
len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name); len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name);
zend_register_long_constant(buf, len, algorithm.value, CONST_PERSISTENT, module_number); zend_register_long_constant(buf, len, algorithm.value, CONST_PERSISTENT|CONST_DEPRECATED, module_number);
} }
/* TODO: this cause #69823 zend_register_internal_module(&mhash_module_entry); */ /* TODO: this cause #69823 zend_register_internal_module(&mhash_module_entry); */

View file

@ -35,56 +35,78 @@ foreach ($supported_hash_al as $hash=>$wanted) {
} }
?> ?>
--EXPECTF-- --EXPECTF--
Deprecated: Constant MHASH_MD5 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_MD5 MHASH_MD5
ok ok
Deprecated: Constant MHASH_SHA1 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_SHA1 MHASH_SHA1
ok ok
Deprecated: Constant MHASH_HAVAL256 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL256 MHASH_HAVAL256
ok ok
Deprecated: Constant MHASH_HAVAL192 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL192 MHASH_HAVAL192
ok ok
Deprecated: Constant MHASH_HAVAL224 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL224 MHASH_HAVAL224
ok ok
Deprecated: Constant MHASH_HAVAL160 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL160 MHASH_HAVAL160
ok ok
Deprecated: Constant MHASH_RIPEMD160 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_RIPEMD160 MHASH_RIPEMD160
ok ok
Deprecated: Constant MHASH_GOST is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_GOST MHASH_GOST
ok ok
Deprecated: Constant MHASH_TIGER is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_TIGER MHASH_TIGER
ok ok
Deprecated: Constant MHASH_CRC32 is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_CRC32 MHASH_CRC32
ok ok
Deprecated: Constant MHASH_CRC32B is deprecated in %s on line %d
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
MHASH_CRC32B MHASH_CRC32B
ok ok

View file

@ -35,56 +35,78 @@ foreach ($supported_hash_al as $hash=>$wanted) {
} }
?> ?>
--EXPECTF-- --EXPECTF--
Deprecated: Constant MHASH_MD5 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_MD5 MHASH_MD5
ok ok
Deprecated: Constant MHASH_SHA1 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_SHA1 MHASH_SHA1
ok ok
Deprecated: Constant MHASH_HAVAL256 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL256 MHASH_HAVAL256
ok ok
Deprecated: Constant MHASH_HAVAL224 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL224 MHASH_HAVAL224
ok ok
Deprecated: Constant MHASH_HAVAL192 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL192 MHASH_HAVAL192
ok ok
Deprecated: Constant MHASH_HAVAL160 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_HAVAL160 MHASH_HAVAL160
ok ok
Deprecated: Constant MHASH_RIPEMD160 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_RIPEMD160 MHASH_RIPEMD160
ok ok
Deprecated: Constant MHASH_GOST is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_GOST MHASH_GOST
ok ok
Deprecated: Constant MHASH_TIGER is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_TIGER MHASH_TIGER
ok ok
Deprecated: Constant MHASH_CRC32 is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_CRC32 MHASH_CRC32
ok ok
Deprecated: Constant MHASH_CRC32B is deprecated in %s on line %d
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
MHASH_CRC32B MHASH_CRC32B
ok ok

View file

@ -12,6 +12,7 @@ var_dump($algo);
?> ?>
--EXPECTF-- --EXPECTF--
Deprecated: Constant MHASH_MD5 is deprecated in %s on line %d
int(1) int(1)
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d