mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Return value of mb_get_info can be NULL
This has been the case at least since PHP 5.4. Thanks to Girgias for pointing it out. It appears that there are several global variables internal to mbstring which can be queried via mb_get_info() and which could be NULL, but at the very least, we know that "mbstring.http_input" is one of them.
This commit is contained in:
parent
b12c85293d
commit
d8ef868b92
@ -235,7 +235,7 @@ static const func_info_t func_infos[] = {
|
||||
F1("mb_convert_variables", MAY_BE_STRING|MAY_BE_FALSE),
|
||||
F1("mb_encode_numericentity", MAY_BE_STRING),
|
||||
F1("mb_decode_numericentity", MAY_BE_STRING),
|
||||
F1("mb_get_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE),
|
||||
F1("mb_get_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL),
|
||||
#if defined(HAVE_MBREGEX)
|
||||
F1("mb_regex_encoding", MAY_BE_STRING|MAY_BE_BOOL),
|
||||
#endif
|
||||
|
@ -171,10 +171,10 @@ function mb_decode_numericentity(string $string, array $map, ?string $encoding =
|
||||
function mb_send_mail(string $to, string $subject, string $message, array|string $additional_headers = [], ?string $additional_params = null): bool {}
|
||||
|
||||
/**
|
||||
* @return array<int|string, int|string|array>|string|int|false
|
||||
* @return array<int|string, int|string|array>|string|int|false|null
|
||||
* @refcount 1
|
||||
*/
|
||||
function mb_get_info(string $type = "all"): array|string|int|false {}
|
||||
function mb_get_info(string $type = "all"): array|string|int|false|null {}
|
||||
|
||||
function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool {}
|
||||
|
||||
|
4
ext/mbstring/mbstring_arginfo.h
generated
4
ext/mbstring/mbstring_arginfo.h
generated
@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 0c9ac8888b8332557f7098cfb9d259757af8b3c6 */
|
||||
* Stub hash: 131af756402aecb88d2265f2a3d25aa5c66a7185 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_language, 0, 0, MAY_BE_STRING|MAY_BE_BOOL)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, language, IS_STRING, 1, "null")
|
||||
@ -177,7 +177,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_send_mail, 0, 3, _IS_BOOL, 0)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_params, IS_STRING, 1, "null")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_get_info, 0, 0, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_get_info, 0, 0, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_STRING, 0, "\"all\"")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
|
10
ext/mbstring/tests/mb_get_info_http_input.phpt
Normal file
10
ext/mbstring/tests/mb_get_info_http_input.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
mb_get_info("http_input") can return null
|
||||
--EXTENSIONS--
|
||||
mbstring
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mb_get_info("http_input"));
|
||||
?>
|
||||
--EXPECT--
|
||||
NULL
|
Loading…
Reference in New Issue
Block a user