diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-22 12:02:39 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-22 12:02:39 +0200 |
commit | 9ef2c5c3035904cfd453ab5c106f7738c6f20e0a (patch) | |
tree | 2d0d30cf839264932d6860480bc4367ad60adcd8 /ext | |
parent | aba0ee71b224ab11a4b940f06dd1146eddbd41a3 (diff) | |
download | php-git-9ef2c5c3035904cfd453ab5c106f7738c6f20e0a.tar.gz |
stream_get_transports/wrappers cannot return false
These may return an empty array, but not false.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opcache/Optimizer/zend_func_info.c | 4 | ||||
-rwxr-xr-x | ext/standard/basic_functions.stub.php | 4 | ||||
-rw-r--r-- | ext/standard/basic_functions_arginfo.h | 6 | ||||
-rw-r--r-- | ext/standard/streamsfuncs.c | 30 |
4 files changed, 19 insertions, 25 deletions
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 10a90aff2d..7ad8ffd5bb 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -316,8 +316,8 @@ static const func_info_t func_infos[] = { F1("get_meta_tags", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING), F1("stream_get_meta_data", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), F1("stream_get_line", MAY_BE_FALSE | MAY_BE_STRING), - F1("stream_get_wrappers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), - F1("stream_get_transports", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("stream_get_wrappers", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), + F1("stream_get_transports", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("stream_resolve_include_path", MAY_BE_FALSE | MAY_BE_STRING), F1("get_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), F1("socket_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY), diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index da890a5735..ae322129ba 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -1339,9 +1339,9 @@ function stream_get_line($handle, int $max_length, string $ending = ""): string| function stream_resolve_include_path(string $filename): string|false {} -function stream_get_wrappers(): array|false {} +function stream_get_wrappers(): array {} -function stream_get_transports(): array|false {} +function stream_get_transports(): array {} /** @param resource|string $stream */ function stream_is_local($stream): bool {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 82a88ddee4..bfa90549b3 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 56fb3ef4c53a1ed7abf6a115567bca47e1a14cda */ + * Stub hash: c61d8a28acaa2a7206f74287dce98282f2fedd2a */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -2011,9 +2011,9 @@ ZEND_END_ARG_INFO() #define arginfo_stream_resolve_include_path arginfo_filetype -#define arginfo_stream_get_wrappers arginfo_net_get_interfaces +#define arginfo_stream_get_wrappers arginfo_ob_list_handlers -#define arginfo_stream_get_transports arginfo_net_get_interfaces +#define arginfo_stream_get_transports arginfo_ob_list_handlers #define arginfo_stream_is_local arginfo_stream_supports_lock diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 8e4c4ff261..1600b99794 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -573,14 +573,11 @@ PHP_FUNCTION(stream_get_transports) ZEND_PARSE_PARAMETERS_NONE(); - if ((stream_xport_hash = php_stream_xport_get_hash())) { - array_init(return_value); - ZEND_HASH_FOREACH_STR_KEY(stream_xport_hash, stream_xport) { - add_next_index_str(return_value, zend_string_copy(stream_xport)); - } ZEND_HASH_FOREACH_END(); - } else { - RETURN_FALSE; - } + stream_xport_hash = php_stream_xport_get_hash(); + array_init(return_value); + ZEND_HASH_FOREACH_STR_KEY(stream_xport_hash, stream_xport) { + add_next_index_str(return_value, zend_string_copy(stream_xport)); + } ZEND_HASH_FOREACH_END(); } /* }}} */ @@ -592,16 +589,13 @@ PHP_FUNCTION(stream_get_wrappers) ZEND_PARSE_PARAMETERS_NONE(); - if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) { - array_init(return_value); - ZEND_HASH_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) { - if (stream_protocol) { - add_next_index_str(return_value, zend_string_copy(stream_protocol)); - } - } ZEND_HASH_FOREACH_END(); - } else { - RETURN_FALSE; - } + url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash(); + array_init(return_value); + ZEND_HASH_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) { + if (stream_protocol) { + add_next_index_str(return_value, zend_string_copy(stream_protocol)); + } + } ZEND_HASH_FOREACH_END(); } /* }}} */ |