From e1feec6feb86425ce1ab36395f6aba8cf5179b94 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 5 Oct 2020 16:53:13 +0200 Subject: [PATCH 1/4] Update ext/sockets parameter names --- ext/sockets/sockets.stub.php | 64 +++++++++--------- ext/sockets/sockets_arginfo.h | 66 +++++++++---------- ext/sockets/tests/mcast_ipv4_send_error.phpt | 4 +- ext/sockets/tests/socket_select_error.phpt | 2 +- ext/sockets/tests/socket_send_params.phpt | 2 +- ext/sockets/tests/socket_sendto_params.phpt | 2 +- .../tests/socket_set_option_rcvtimeo.phpt | 5 +- .../tests/socket_set_option_seolinger.phpt | 7 +- .../tests/socket_set_option_sndtimeo.phpt | 5 +- 9 files changed, 74 insertions(+), 83 deletions(-) diff --git a/ext/sockets/sockets.stub.php b/ext/sockets/sockets.stub.php index 8acab114e563d..f7949479cec2d 100644 --- a/ext/sockets/sockets.stub.php +++ b/ext/sockets/sockets.stub.php @@ -10,7 +10,7 @@ final class AddressInfo { } -function socket_select(?array &$read_fds, ?array &$write_fds, ?array &$except_fds, ?int $tv_sec, int $tv_usec = 0): int|false {} +function socket_select(?array &$read, ?array &$write, ?array &$except, ?int $seconds, int $microseconds = 0): int|false {} function socket_create_listen(int $port, int $backlog = 128): Socket|false {} @@ -24,65 +24,65 @@ function socket_listen(Socket $socket, int $backlog = 0): bool {} function socket_close(Socket $socket): void {} -function socket_write(Socket $socket, string $buf, ?int $length = null): int|false {} +function socket_write(Socket $socket, string $data, ?int $max_length = null): int|false {} -function socket_read(Socket $socket, int $length, int $type = PHP_BINARY_READ): string|false {} +function socket_read(Socket $socket, int $length, int $mode = PHP_BINARY_READ): string|false {} /** - * @param string $addr + * @param string $address * @param int $port */ -function socket_getsockname(Socket $socket, &$addr, &$port = null): bool {} +function socket_getsockname(Socket $socket, &$address, &$port = null): bool {} /** - * @param string $addr + * @param string $address * @param int $port */ -function socket_getpeername(Socket $socket, &$addr, &$port = null): bool {} +function socket_getpeername(Socket $socket, &$address, &$port = null): bool {} function socket_create(int $domain, int $type, int $protocol): Socket|false {} -function socket_connect(Socket $socket, string $addr, ?int $port = null): bool {} +function socket_connect(Socket $socket, string $address, ?int $port = null): bool {} -function socket_strerror(int $errno): string {} +function socket_strerror(int $error_code): string {} -function socket_bind(Socket $socket, string $addr, int $port = 0): bool {} +function socket_bind(Socket $socket, string $address, int $port = 0): bool {} -/** @param string|null $buf */ -function socket_recv(Socket $socket, &$buf, int $len, int $flags): int|false {} +/** @param string|null $data */ +function socket_recv(Socket $socket, &$data, int $length, int $flags): int|false {} -function socket_send(Socket $socket, string $buf, int $len, int $flags): int|false {} +function socket_send(Socket $socket, string $data, int $length, int $flags): int|false {} /** - * @param string $buf - * @param string $name + * @param string $data + * @param string $address * @param int $port */ -function socket_recvfrom(Socket $socket, &$buf, int $len, int $flags, &$name, &$port = null): int|false {} +function socket_recvfrom(Socket $socket, &$data, int $length, int $flags, &$address, &$port = null): int|false {} -function socket_sendto(Socket $socket, string $buf, int $len, int $flags, string $addr, ?int $port = null): int|false {} +function socket_sendto(Socket $socket, string $data, int $length, int $flags, string $address, ?int $port = null): int|false {} -function socket_get_option(Socket $socket, int $level, int $optname): array|int|false {} +function socket_get_option(Socket $socket, int $level, int $option): array|int|false {} /** @alias socket_get_option */ -function socket_getopt(Socket $socket, int $level, int $optname): array|int|false {} +function socket_getopt(Socket $socket, int $level, int $option): array|int|false {} -/** @param array|string|int $optval */ -function socket_set_option(Socket $socket, int $level, int $optname, $optval): bool {} +/** @param array|string|int $value */ +function socket_set_option(Socket $socket, int $level, int $option, $value): bool {} /** - * @param array|string|int $optval + * @param array|string|int $value * @alias socket_set_option */ -function socket_setopt(Socket $socket, int $level, int $optname, $optval): bool {} +function socket_setopt(Socket $socket, int $level, int $option, $value): bool {} #ifdef HAVE_SOCKETPAIR -/** @param array $fd */ -function socket_create_pair(int $domain, int $type, int $protocol, &$fd): ?bool {} +/** @param array $pair */ +function socket_create_pair(int $domain, int $type, int $protocol, &$pair): ?bool {} #endif #ifdef HAVE_SHUTDOWN -function socket_shutdown(Socket $socket, int $how = 2): bool {} +function socket_shutdown(Socket $socket, int $mode = 2): bool {} #endif function socket_last_error(?Socket $socket = null): int {} @@ -95,19 +95,19 @@ function socket_import_stream($stream): Socket|false {} /** @return resource|false */ function socket_export_stream(Socket $socket) {} -function socket_sendmsg(Socket $socket, array $msghdr, int $flags = 0): int|false {} +function socket_sendmsg(Socket $socket, array $message, int $flags = 0): int|false {} -function socket_recvmsg(Socket $socket, array &$msghdr, int $flags = 0): int|false {} +function socket_recvmsg(Socket $socket, array &$message, int $flags = 0): int|false {} -function socket_cmsg_space(int $level, int $type, int $n = 0): ?int {} +function socket_cmsg_space(int $level, int $type, int $num = 0): ?int {} function socket_addrinfo_lookup(string $host, ?string $service = null, array $hints = []): array|false {} -function socket_addrinfo_connect(AddressInfo $addr): Socket|false {} +function socket_addrinfo_connect(AddressInfo $address): Socket|false {} -function socket_addrinfo_bind(AddressInfo $addr): Socket|false {} +function socket_addrinfo_bind(AddressInfo $address): Socket|false {} -function socket_addrinfo_explain(AddressInfo $addr): array {} +function socket_addrinfo_explain(AddressInfo $address): array {} #ifdef PHP_WIN32 function socket_wsaprotocol_info_export(Socket $socket, int $target_pid): string|false {} diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h index 0923918a9419c..0e4b0efcdf2b6 100644 --- a/ext/sockets/sockets_arginfo.h +++ b/ext/sockets/sockets_arginfo.h @@ -1,12 +1,12 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: f35790f5f703b37c45230e97e8f0ee736727b4bd */ + * Stub hash: 35196eb31a98dd0b30761eed91f10a8b7e814f9e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(1, read_fds, IS_ARRAY, 1) - ZEND_ARG_TYPE_INFO(1, write_fds, IS_ARRAY, 1) - ZEND_ARG_TYPE_INFO(1, except_fds, IS_ARRAY, 1) - ZEND_ARG_TYPE_INFO(0, tv_sec, IS_LONG, 1) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tv_usec, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1) + ZEND_ARG_TYPE_INFO(1, write, IS_ARRAY, 1) + ZEND_ARG_TYPE_INFO(1, except, IS_ARRAY, 1) + ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 1) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, microseconds, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_socket_create_listen, 0, 1, Socket, MAY_BE_FALSE) @@ -35,19 +35,19 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_read, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "PHP_BINARY_READ") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PHP_BINARY_READ") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_getsockname, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_INFO(1, addr) + ZEND_ARG_INFO(1, address) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, port, "null") ZEND_END_ARG_INFO() @@ -61,56 +61,56 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_connect, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(0, addr, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, address, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_strerror, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, error_code, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_bind, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(0, addr, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, address, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_recv, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_INFO(1, buf) - ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0) + ZEND_ARG_INFO(1, data) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_send, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_recvfrom, 0, 5, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_INFO(1, buf) - ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0) + ZEND_ARG_INFO(1, data) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) - ZEND_ARG_INFO(1, name) + ZEND_ARG_INFO(1, address) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, port, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_sendto, 0, 5, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, addr, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, address, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_get_option, 0, 3, MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, optname, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) ZEND_END_ARG_INFO() #define arginfo_socket_getopt arginfo_socket_get_option @@ -118,8 +118,8 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_set_option, 0, 4, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, optname, IS_LONG, 0) - ZEND_ARG_INFO(0, optval) + ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) + ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() #define arginfo_socket_setopt arginfo_socket_set_option @@ -129,14 +129,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_create_pair, 0, 4, _IS_BO ZEND_ARG_TYPE_INFO(0, domain, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, protocol, IS_LONG, 0) - ZEND_ARG_INFO(1, fd) + ZEND_ARG_INFO(1, pair) ZEND_END_ARG_INFO() #endif #if defined(HAVE_SHUTDOWN) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_shutdown, 0, 1, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, how, IS_LONG, 0, "2") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "2") ZEND_END_ARG_INFO() #endif @@ -158,20 +158,20 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_sendmsg, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(0, msghdr, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_recvmsg, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(1, msghdr, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(1, message, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_cmsg_space, 0, 2, IS_LONG, 1) ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, n, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, num, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_addrinfo_lookup, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) @@ -181,13 +181,13 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_addrinfo_lookup, 0, 1, MA ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_socket_addrinfo_connect, 0, 1, Socket, MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, addr, AddressInfo, 0) + ZEND_ARG_OBJ_INFO(0, address, AddressInfo, 0) ZEND_END_ARG_INFO() #define arginfo_socket_addrinfo_bind arginfo_socket_addrinfo_connect ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_addrinfo_explain, 0, 1, IS_ARRAY, 0) - ZEND_ARG_OBJ_INFO(0, addr, AddressInfo, 0) + ZEND_ARG_OBJ_INFO(0, address, AddressInfo, 0) ZEND_END_ARG_INFO() #if defined(PHP_WIN32) diff --git a/ext/sockets/tests/mcast_ipv4_send_error.phpt b/ext/sockets/tests/mcast_ipv4_send_error.phpt index 5e3ff394cf1b7..31460f4d61070 100644 --- a/ext/sockets/tests/mcast_ipv4_send_error.phpt +++ b/ext/sockets/tests/mcast_ipv4_send_error.phpt @@ -77,7 +77,7 @@ bool(true) int(0) Setting IP_MULTICAST_TTL with 256 -socket_set_option(): Argument #4 ($optval) must be between 0 and 255 +socket_set_option(): Argument #4 ($value) must be between 0 and 255 int(1) Setting IP_MULTICAST_TTL with "254" @@ -85,5 +85,5 @@ bool(true) int(254) Setting IP_MULTICAST_TTL with -1 -socket_set_option(): Argument #4 ($optval) must be between 0 and 255 +socket_set_option(): Argument #4 ($value) must be between 0 and 255 int(254) diff --git a/ext/sockets/tests/socket_select_error.phpt b/ext/sockets/tests/socket_select_error.phpt index 645707467dc1c..02e4f45ebeba4 100644 --- a/ext/sockets/tests/socket_select_error.phpt +++ b/ext/sockets/tests/socket_select_error.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -socket_select(): Argument #1 ($read_fds) must only have elements of type Socket, string given +socket_select(): Argument #1 ($read) must only have elements of type Socket, string given diff --git a/ext/sockets/tests/socket_send_params.phpt b/ext/sockets/tests/socket_send_params.phpt index 4c3f57729f597..1adf9d59d8228 100644 --- a/ext/sockets/tests/socket_send_params.phpt +++ b/ext/sockets/tests/socket_send_params.phpt @@ -17,4 +17,4 @@ ext/sockets - socket_send - test with incorrect parameters socket_close($s_c); ?> --EXPECT-- -socket_send(): Argument #3 ($len) must be greater than or equal to 0 +socket_send(): Argument #3 ($length) must be greater than or equal to 0 diff --git a/ext/sockets/tests/socket_sendto_params.phpt b/ext/sockets/tests/socket_sendto_params.phpt index 09cb859ad75fe..c80c6a7ff1c57 100644 --- a/ext/sockets/tests/socket_sendto_params.phpt +++ b/ext/sockets/tests/socket_sendto_params.phpt @@ -17,4 +17,4 @@ ext/sockets - socket_sendto - test with incorrect parameters socket_close($s_c); ?> --EXPECT-- -socket_sendto(): Argument #3 ($len) must be greater than or equal to 0 +socket_sendto(): Argument #3 ($length) must be greater than or equal to 0 diff --git a/ext/sockets/tests/socket_set_option_rcvtimeo.phpt b/ext/sockets/tests/socket_set_option_rcvtimeo.phpt index 819d0ee443696..fdc73fe43b1ff 100644 --- a/ext/sockets/tests/socket_set_option_rcvtimeo.phpt +++ b/ext/sockets/tests/socket_set_option_rcvtimeo.phpt @@ -34,9 +34,6 @@ var_dump($retval_3 === $options); socket_close($socket); ?> --EXPECT-- -socket_set_option(): Argument #4 ($optval) must have key "sec" +socket_set_option(): Argument #4 ($value) must have key "sec" bool(true) bool(true) ---CREDITS-- -Moritz Neuhaeuser, info@xcompile.net -PHP Testfest Berlin 2009-05-10 diff --git a/ext/sockets/tests/socket_set_option_seolinger.phpt b/ext/sockets/tests/socket_set_option_seolinger.phpt index 132d4e0c6e04b..876cbb3fdbe6b 100644 --- a/ext/sockets/tests/socket_set_option_seolinger.phpt +++ b/ext/sockets/tests/socket_set_option_seolinger.phpt @@ -45,11 +45,8 @@ var_dump((bool)$retval_3["l_onoff"] === (bool)$options["l_onoff"]); socket_close($socket); ?> --EXPECT-- -socket_set_option(): Argument #4 ($optval) must have key "l_onoff" -socket_set_option(): Argument #4 ($optval) must have key "l_linger" +socket_set_option(): Argument #4 ($value) must have key "l_onoff" +socket_set_option(): Argument #4 ($value) must have key "l_linger" bool(true) bool(true) bool(true) ---CREDITS-- -Moritz Neuhaeuser, info@xcompile.net -PHP Testfest Berlin 2009-05-10 diff --git a/ext/sockets/tests/socket_set_option_sndtimeo.phpt b/ext/sockets/tests/socket_set_option_sndtimeo.phpt index 359aab9ae9a5b..f1c7e9ddc2f09 100644 --- a/ext/sockets/tests/socket_set_option_sndtimeo.phpt +++ b/ext/sockets/tests/socket_set_option_sndtimeo.phpt @@ -34,9 +34,6 @@ var_dump($retval_3 === $options); socket_close($socket); ?> --EXPECT-- -socket_set_option(): Argument #4 ($optval) must have key "sec" +socket_set_option(): Argument #4 ($value) must have key "sec" bool(true) bool(true) ---CREDITS-- -Moritz Neuhaeuser, info@xcompile.net -PHP Testfest Berlin 2009-05-10 From ed2c6bf9ddc9909be80cad654824696166508e78 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 6 Oct 2020 10:00:57 +0200 Subject: [PATCH 2/4] $target_pid -> $process_id --- ext/sockets/sockets.stub.php | 2 +- ext/sockets/sockets_arginfo.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/sockets/sockets.stub.php b/ext/sockets/sockets.stub.php index f7949479cec2d..c3445ab530f6b 100644 --- a/ext/sockets/sockets.stub.php +++ b/ext/sockets/sockets.stub.php @@ -110,7 +110,7 @@ function socket_addrinfo_bind(AddressInfo $address): Socket|false {} function socket_addrinfo_explain(AddressInfo $address): array {} #ifdef PHP_WIN32 -function socket_wsaprotocol_info_export(Socket $socket, int $target_pid): string|false {} +function socket_wsaprotocol_info_export(Socket $socket, int $process_id): string|false {} function socket_wsaprotocol_info_import(string $info_id): Socket|false {} diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h index 0e4b0efcdf2b6..bd50425d017c8 100644 --- a/ext/sockets/sockets_arginfo.h +++ b/ext/sockets/sockets_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 35196eb31a98dd0b30761eed91f10a8b7e814f9e */ + * Stub hash: 58b939e7e18129e0072d6e0c02f845f7cfd4242a */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1) @@ -193,7 +193,7 @@ ZEND_END_ARG_INFO() #if defined(PHP_WIN32) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_wsaprotocol_info_export, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) - ZEND_ARG_TYPE_INFO(0, target_pid, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, process_id, IS_LONG, 0) ZEND_END_ARG_INFO() #endif From 91a23be1ca1342caacb71c7e7a0cf4449e4a40e1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 6 Oct 2020 10:52:13 +0200 Subject: [PATCH 3/4] $max_length -> $length in most places --- ext/bz2/bz2.stub.php | 2 +- ext/bz2/bz2_arginfo.h | 4 ++-- ext/sockets/sockets.stub.php | 2 +- ext/sockets/sockets_arginfo.h | 4 ++-- ext/standard/basic_functions.stub.php | 12 ++++++------ ext/standard/basic_functions_arginfo.h | 12 ++++++------ ext/standard/tests/file/file_get_contents_error.phpt | 2 +- .../tests/file/file_get_contents_error002.phpt | 2 +- .../file_get_contents_file_put_contents_error.phpt | 2 +- ext/zlib/zlib.stub.php | 4 ++-- ext/zlib/zlib_arginfo.h | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ext/bz2/bz2.stub.php b/ext/bz2/bz2.stub.php index d1d9928ebf1e6..c1709e8b3325f 100644 --- a/ext/bz2/bz2.stub.php +++ b/ext/bz2/bz2.stub.php @@ -15,7 +15,7 @@ function bzread($bz, int $length = 1024): string|false {} * @param resource $bz * @alias fwrite */ -function bzwrite($bz, string $data, ?int $max_length = null): int|false {} +function bzwrite($bz, string $data, ?int $length = null): int|false {} /** * @param resource $bz diff --git a/ext/bz2/bz2_arginfo.h b/ext/bz2/bz2_arginfo.h index 236d3e6dfcb49..83073c0de75bd 100644 --- a/ext/bz2/bz2_arginfo.h +++ b/ext/bz2/bz2_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e18326d2ddbe564858abb531fc41b7907fba35c4 */ + * Stub hash: 8eefa180e67776e8e0ba1b27fbf9b32c5b71725c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2) ZEND_ARG_INFO(0, file) @@ -14,7 +14,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_INFO(0, bz) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzflush, 0, 1, _IS_BOOL, 0) diff --git a/ext/sockets/sockets.stub.php b/ext/sockets/sockets.stub.php index c3445ab530f6b..1a62d83193797 100644 --- a/ext/sockets/sockets.stub.php +++ b/ext/sockets/sockets.stub.php @@ -24,7 +24,7 @@ function socket_listen(Socket $socket, int $backlog = 0): bool {} function socket_close(Socket $socket): void {} -function socket_write(Socket $socket, string $data, ?int $max_length = null): int|false {} +function socket_write(Socket $socket, string $data, ?int $length = null): int|false {} function socket_read(Socket $socket, int $length, int $mode = PHP_BINARY_READ): string|false {} diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h index bd50425d017c8..f86f2250267ae 100644 --- a/ext/sockets/sockets_arginfo.h +++ b/ext/sockets/sockets_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 58b939e7e18129e0072d6e0c02f845f7cfd4242a */ + * Stub hash: ee025740240c285691a84cfa3563c1dd1586a75d */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1) @@ -36,7 +36,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, socket, Socket, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_read, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 5d7caf8ca80ab..ec97181854b10 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -823,13 +823,13 @@ function ftell($stream): int|false {} function fflush($stream): bool {} /** @param resource $stream */ -function fwrite($stream, string $data, ?int $max_length = null): int|false {} +function fwrite($stream, string $data, ?int $length = null): int|false {} /** * @param resource $stream * @alias fwrite */ -function fputs($stream, string $data, ?int $max_length = null): int|false {} +function fputs($stream, string $data, ?int $length = null): int|false {} /** @param resource|null $context */ function mkdir(string $directory, int $permissions = 0777, bool $recursive = false, $context = null): bool {} @@ -849,7 +849,7 @@ function tmpfile() {} function file(string $filename, int $flags = 0, $context = null): array|false {} /** @param resource|null $context */ -function file_get_contents(string $filename, bool $use_include_path = false, $context = null, int $offset = 0, ?int $max_length = null): string|false {} +function file_get_contents(string $filename, bool $use_include_path = false, $context = null, int $offset = 0, ?int $length = null): string|false {} /** @param resource|null $context */ function unlink(string $filename, $context = null): bool {} @@ -1293,10 +1293,10 @@ function stream_socket_pair(int $domain, int $type, int $protocol): array|false * @param resource $from * @param resource $to */ -function stream_copy_to_stream($from, $to, ?int $max_length = null, int $offset = 0): int|false {} +function stream_copy_to_stream($from, $to, ?int $length = null, int $offset = 0): int|false {} /** @param resource $stream */ -function stream_get_contents($stream, ?int $max_length = null, int $offset = -1): string|false {} +function stream_get_contents($stream, ?int $length = null, int $offset = -1): string|false {} /** @param resource $stream */ function stream_supports_lock($stream): bool {} @@ -1332,7 +1332,7 @@ function stream_get_meta_data($stream): array {} function socket_get_status($stream): array {} /** @param resource $stream */ -function stream_get_line($stream, int $max_length, string $ending = ""): string|false {} +function stream_get_line($stream, int $length, string $ending = ""): string|false {} function stream_resolve_include_path(string $filename): string|false {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 47a00ca97945c..6af3931ad496d 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: bb98cb703c3ad25c11d21ee7b159acda93677cc3 */ + * Stub hash: 5414c8c3ed41482650a15a7ec6ddf0bb6489091a */ 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) @@ -1268,7 +1268,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() #define arginfo_fputs arginfo_fwrite @@ -1307,7 +1307,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_file_get_contents, 0, 1, MAY_BE_ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, use_include_path, _IS_BOOL, 0, "false") ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_unlink, 0, 1, _IS_BOOL, 0) @@ -1953,13 +1953,13 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_copy_to_stream, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_INFO(0, from) ZEND_ARG_INFO(0, to) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_get_contents, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, stream) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "-1") ZEND_END_ARG_INFO() @@ -1989,7 +1989,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_get_line, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, stream) - ZEND_ARG_TYPE_INFO(0, max_length, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ending, IS_STRING, 0, "\"\"") ZEND_END_ARG_INFO() diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt index 8e29847d8cf27..12ddfc73f5787 100644 --- a/ext/standard/tests/file/file_get_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_error.phpt @@ -47,6 +47,6 @@ if(file_exists($file_path."/file_put_contents1.tmp")) { Warning: file_get_contents(/no/such/file/or/dir): Failed to open stream: No such file or directory in %s on line %d -- Testing for invalid negative maxlen values -- -file_get_contents(): Argument #5 ($max_length) must be greater than or equal to 0 +file_get_contents(): Argument #5 ($length) must be greater than or equal to 0 *** Done *** diff --git a/ext/standard/tests/file/file_get_contents_error002.phpt b/ext/standard/tests/file/file_get_contents_error002.phpt index a58308d831b0d..d47efa26a1b97 100644 --- a/ext/standard/tests/file/file_get_contents_error002.phpt +++ b/ext/standard/tests/file/file_get_contents_error002.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -file_get_contents(): Argument #5 ($max_length) must be greater than or equal to 0 +file_get_contents(): Argument #5 ($length) must be greater than or equal to 0 diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt index c41a826bf958f..9a576bd26c8e0 100644 --- a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt @@ -39,6 +39,6 @@ unlink($file_path."/file_put_contents1.tmp"); Warning: file_get_contents(/no/such/file/or/dir): Failed to open stream: No such file or directory in %s on line %d -- Testing for invalid negative maxlen values -- -file_get_contents(): Argument #5 ($max_length) must be greater than or equal to 0 +file_get_contents(): Argument #5 ($length) must be greater than or equal to 0 *** Done *** diff --git a/ext/zlib/zlib.stub.php b/ext/zlib/zlib.stub.php index e03a9e55955d8..fdb7e7c8efe45 100644 --- a/ext/zlib/zlib.stub.php +++ b/ext/zlib/zlib.stub.php @@ -41,13 +41,13 @@ function gzuncompress(string $data, int $max_length = 0): string|false {} * @param resource $stream * @alias fwrite */ -function gzwrite($stream, string $data, ?int $max_length = null): int|false {} +function gzwrite($stream, string $data, ?int $length = null): int|false {} /** * @param resource $stream * @alias fwrite */ -function gzputs($stream, string $data, ?int $max_length = null): int|false {} +function gzputs($stream, string $data, ?int $length = null): int|false {} /** * @param resource $stream diff --git a/ext/zlib/zlib_arginfo.h b/ext/zlib/zlib_arginfo.h index 3f9eb40809397..76b966093d711 100644 --- a/ext/zlib/zlib_arginfo.h +++ b/ext/zlib/zlib_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e9347c139d418c36d889d2becf57535f1c76efed */ + * Stub hash: 4106a50d3930915e47548be72f984420c5af6149 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_gzhandler, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) @@ -63,7 +63,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_END_ARG_INFO() #define arginfo_gzputs arginfo_gzwrite From 0f429a42a0a65b46dbe7b3d19d77282c85a012d5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 6 Oct 2020 11:10:57 +0200 Subject: [PATCH 4/4] Fix tests --- ext/phar/tests/fgc_edgecases.phpt | 2 +- .../tests/streams/stream_get_contents_negative_length.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt index aad575749bd37..ae9381ff1e6c7 100644 --- a/ext/phar/tests/fgc_edgecases.phpt +++ b/ext/phar/tests/fgc_edgecases.phpt @@ -71,7 +71,7 @@ echo file_get_contents("./hi", 0, $context, 50000); echo file_get_contents("./hi"); echo file_get_contents("./hi", 0, $context, 0, 0); ?> -file_get_contents(): Argument #5 ($max_length) must be greater than or equal to 0 +file_get_contents(): Argument #5 ($length) must be greater than or equal to 0 test test --EXPECT-- string(2) "bc" -stream_get_contents(): Argument #2 ($max_length) must be greater than or equal to -1 +stream_get_contents(): Argument #2 ($length) must be greater than or equal to -1