]> granicus.if.org Git - php/commitdiff
Accept null context in stream_socket_(client|server)
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 9 Apr 2020 13:36:29 +0000 (15:36 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 9 Apr 2020 14:10:27 +0000 (16:10 +0200)
ext/standard/basic_functions.stub.php
ext/standard/streamsfuncs.c

index 0c1c1ee380de5439c082e376aad4f256ebec70b4..557151a31d16ad3532ac14a3d5f0aac87bc40737 100755 (executable)
@@ -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) {}
index 1bc338dc92f52f649541fe751df7f5d47ecb186f..4922fdf4cc8956a9b9e23a67274775d062a5a20b 100644 (file)
@@ -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);