Skip to content

Commit 9ef2c5c

Browse files
committed
stream_get_transports/wrappers cannot return false
These may return an empty array, but not false.
1 parent aba0ee7 commit 9ef2c5c

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ static const func_info_t func_infos[] = {
316316
F1("get_meta_tags", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
317317
F1("stream_get_meta_data", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
318318
F1("stream_get_line", MAY_BE_FALSE | MAY_BE_STRING),
319-
F1("stream_get_wrappers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
320-
F1("stream_get_transports", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
319+
F1("stream_get_wrappers", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
320+
F1("stream_get_transports", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
321321
F1("stream_resolve_include_path", MAY_BE_FALSE | MAY_BE_STRING),
322322
F1("get_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
323323
F1("socket_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),

ext/standard/basic_functions.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,9 +1339,9 @@ function stream_get_line($handle, int $max_length, string $ending = ""): string|
13391339

13401340
function stream_resolve_include_path(string $filename): string|false {}
13411341

1342-
function stream_get_wrappers(): array|false {}
1342+
function stream_get_wrappers(): array {}
13431343

1344-
function stream_get_transports(): array|false {}
1344+
function stream_get_transports(): array {}
13451345

13461346
/** @param resource|string $stream */
13471347
function stream_is_local($stream): bool {}

ext/standard/basic_functions_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 56fb3ef4c53a1ed7abf6a115567bca47e1a14cda */
2+
* Stub hash: c61d8a28acaa2a7206f74287dce98282f2fedd2a */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -2011,9 +2011,9 @@ ZEND_END_ARG_INFO()
20112011

20122012
#define arginfo_stream_resolve_include_path arginfo_filetype
20132013

2014-
#define arginfo_stream_get_wrappers arginfo_net_get_interfaces
2014+
#define arginfo_stream_get_wrappers arginfo_ob_list_handlers
20152015

2016-
#define arginfo_stream_get_transports arginfo_net_get_interfaces
2016+
#define arginfo_stream_get_transports arginfo_ob_list_handlers
20172017

20182018
#define arginfo_stream_is_local arginfo_stream_supports_lock
20192019

ext/standard/streamsfuncs.c

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,11 @@ PHP_FUNCTION(stream_get_transports)
573573

574574
ZEND_PARSE_PARAMETERS_NONE();
575575

576-
if ((stream_xport_hash = php_stream_xport_get_hash())) {
577-
array_init(return_value);
578-
ZEND_HASH_FOREACH_STR_KEY(stream_xport_hash, stream_xport) {
579-
add_next_index_str(return_value, zend_string_copy(stream_xport));
580-
} ZEND_HASH_FOREACH_END();
581-
} else {
582-
RETURN_FALSE;
583-
}
576+
stream_xport_hash = php_stream_xport_get_hash();
577+
array_init(return_value);
578+
ZEND_HASH_FOREACH_STR_KEY(stream_xport_hash, stream_xport) {
579+
add_next_index_str(return_value, zend_string_copy(stream_xport));
580+
} ZEND_HASH_FOREACH_END();
584581
}
585582
/* }}} */
586583

@@ -592,16 +589,13 @@ PHP_FUNCTION(stream_get_wrappers)
592589

593590
ZEND_PARSE_PARAMETERS_NONE();
594591

595-
if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
596-
array_init(return_value);
597-
ZEND_HASH_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) {
598-
if (stream_protocol) {
599-
add_next_index_str(return_value, zend_string_copy(stream_protocol));
600-
}
601-
} ZEND_HASH_FOREACH_END();
602-
} else {
603-
RETURN_FALSE;
604-
}
592+
url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash();
593+
array_init(return_value);
594+
ZEND_HASH_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) {
595+
if (stream_protocol) {
596+
add_next_index_str(return_value, zend_string_copy(stream_protocol));
597+
}
598+
} ZEND_HASH_FOREACH_END();
605599

606600
}
607601
/* }}} */

0 commit comments

Comments
 (0)