mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/hash: Add #[\Deprecated] to MHASH_* constants (#19565)
This commit is contained in:
@@ -1178,6 +1178,7 @@ static void mhash_init(INIT_FUNC_ARGS)
|
||||
int len;
|
||||
int algo_number = 0;
|
||||
|
||||
zend_string *deprecation_reason = zend_string_init("as the mhash*() functions were deprecated", strlen("as the mhash*() functions were deprecated"), 1);
|
||||
for (algo_number = 0; algo_number < MHASH_NUM_ALGOS; algo_number++) {
|
||||
struct mhash_bc_entry algorithm = mhash_to_hash[algo_number];
|
||||
if (algorithm.mhash_name == NULL) {
|
||||
@@ -1185,8 +1186,18 @@ static void mhash_init(INIT_FUNC_ARGS)
|
||||
}
|
||||
|
||||
len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name);
|
||||
zend_register_long_constant(buf, len, algorithm.value, CONST_PERSISTENT|CONST_DEPRECATED, module_number);
|
||||
zend_constant *mhash_const = zend_register_long_constant(buf, len, algorithm.value, CONST_PERSISTENT|CONST_DEPRECATED, module_number);
|
||||
|
||||
zend_attribute *deprecation_attrib = zend_add_global_constant_attribute(mhash_const, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2);
|
||||
ZVAL_STR(&deprecation_attrib->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5));
|
||||
deprecation_attrib->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE);
|
||||
ZVAL_STR_COPY(&deprecation_attrib->args[1].value, deprecation_reason);
|
||||
deprecation_attrib->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE);
|
||||
}
|
||||
/* Each of the attributes uses ZVAL_STR_COPY instead of trying to special
|
||||
* case one of them to use ZVAL_STR, but that means there is one more
|
||||
* reference that needs to be decremented. */
|
||||
zend_string_release(deprecation_reason);
|
||||
|
||||
/* TODO: this cause #69823 zend_register_internal_module(&mhash_module_entry); */
|
||||
}
|
||||
|
||||
@@ -35,77 +35,77 @@ foreach ($supported_hash_al as $hash=>$wanted) {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Constant MHASH_MD5 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_MD5 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_MD5
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_SHA1 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_SHA1 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_SHA1
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL256 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL256 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL256
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL192 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL192 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL192
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL224 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL224 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL224
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL160 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL160 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL160
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_RIPEMD160 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_RIPEMD160 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_RIPEMD160
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_GOST is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_GOST is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_GOST
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_TIGER is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_TIGER is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_TIGER
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_CRC32 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_CRC32 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_CRC32
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_CRC32B is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_CRC32B is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_CRC32B
|
||||
|
||||
@@ -35,77 +35,77 @@ foreach ($supported_hash_al as $hash=>$wanted) {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Constant MHASH_MD5 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_MD5 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_MD5
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_SHA1 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_SHA1 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_SHA1
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL256 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL256 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL256
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL224 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL224 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL224
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL192 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL192 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL192
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_HAVAL160 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_HAVAL160 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_HAVAL160
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_RIPEMD160 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_RIPEMD160 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_RIPEMD160
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_GOST is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_GOST is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_GOST
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_TIGER is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_TIGER is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_TIGER
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_CRC32 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_CRC32 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_CRC32
|
||||
ok
|
||||
|
||||
|
||||
Deprecated: Constant MHASH_CRC32B is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_CRC32B is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
|
||||
Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d
|
||||
MHASH_CRC32B
|
||||
|
||||
@@ -12,7 +12,7 @@ var_dump($algo);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: Constant MHASH_MD5 is deprecated in %s on line %d
|
||||
Deprecated: Constant MHASH_MD5 is deprecated since 8.5, as the mhash*() functions were deprecated in %s on line %d
|
||||
int(1)
|
||||
|
||||
Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d
|
||||
|
||||
Reference in New Issue
Block a user