Skip to content

Commit d8ef868

Browse files
committed
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.
1 parent b12c852 commit d8ef868

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

Zend/Optimizer/zend_func_infos.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static const func_info_t func_infos[] = {
235235
F1("mb_convert_variables", MAY_BE_STRING|MAY_BE_FALSE),
236236
F1("mb_encode_numericentity", MAY_BE_STRING),
237237
F1("mb_decode_numericentity", MAY_BE_STRING),
238-
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),
238+
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),
239239
#if defined(HAVE_MBREGEX)
240240
F1("mb_regex_encoding", MAY_BE_STRING|MAY_BE_BOOL),
241241
#endif

ext/mbstring/mbstring.stub.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ function mb_decode_numericentity(string $string, array $map, ?string $encoding =
171171
function mb_send_mail(string $to, string $subject, string $message, array|string $additional_headers = [], ?string $additional_params = null): bool {}
172172

173173
/**
174-
* @return array<int|string, int|string|array>|string|int|false
174+
* @return array<int|string, int|string|array>|string|int|false|null
175175
* @refcount 1
176176
*/
177-
function mb_get_info(string $type = "all"): array|string|int|false {}
177+
function mb_get_info(string $type = "all"): array|string|int|false|null {}
178178

179179
function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool {}
180180

ext/mbstring/mbstring_arginfo.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
mb_get_info("http_input") can return null
3+
--EXTENSIONS--
4+
mbstring
5+
--FILE--
6+
<?php
7+
var_dump(mb_get_info("http_input"));
8+
?>
9+
--EXPECT--
10+
NULL

0 commit comments

Comments
 (0)