From: Nikita Popov Date: Thu, 9 Apr 2020 13:36:29 +0000 (+0200) Subject: Accept null context in stream_socket_(client|server) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=217dfc0832ce0fca48d7d7a70e7b6057520cb529;p=php Accept null context in stream_socket_(client|server) --- diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 0c1c1ee380..557151a31d 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -1260,13 +1260,13 @@ function stream_filter_append($stream, string $filtername, int $read_write = 0, function stream_filter_remove($stream_filter): bool {} /** - * @param resource $context + * @param resource|null $context * @return resource|false */ function stream_socket_client(string $remote_socket, &$errno = null, &$errstr = null, float $timeout = STREAM_CLIENT_CONNECT, int $flags = UNKNOWN, $context = null) {} /** - * @param resource $context + * @param resource|null $context * @return resource|false */ function stream_socket_server(string $local_socket, &$errno = null, &$errstr = null, int $flags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context = null) {} diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 1bc338dc92..4922fdf4cc 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -109,7 +109,7 @@ PHP_FUNCTION(stream_socket_client) Z_PARAM_ZVAL(zerrstr) Z_PARAM_DOUBLE(timeout) Z_PARAM_LONG(flags) - Z_PARAM_RESOURCE(zcontext) + Z_PARAM_RESOURCE_OR_NULL(zcontext) ZEND_PARSE_PARAMETERS_END(); context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); @@ -194,7 +194,7 @@ PHP_FUNCTION(stream_socket_server) Z_PARAM_ZVAL(zerrno) Z_PARAM_ZVAL(zerrstr) Z_PARAM_LONG(flags) - Z_PARAM_RESOURCE(zcontext) + Z_PARAM_RESOURCE_OR_NULL(zcontext) ZEND_PARSE_PARAMETERS_END(); context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);