From 79484b4f8a9f57cc08c355897e17d406ec94bdb9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 5 Oct 2020 16:53:13 +0200 Subject: [PATCH] Update ext/sockets parameter names Also change $max_length to $length in a number of filesystem APIs, where our usage was inconsistent. Closes GH-6276. --- ext/bz2/bz2.stub.php | 2 +- ext/bz2/bz2_arginfo.h | 4 +- ext/phar/tests/fgc_edgecases.phpt | 2 +- ext/sockets/sockets.stub.php | 66 +++++++++---------- 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 +- ext/standard/basic_functions.stub.php | 12 ++-- ext/standard/basic_functions_arginfo.h | 12 ++-- .../tests/file/file_get_contents_error.phpt | 2 +- .../file/file_get_contents_error002.phpt | 2 +- ..._get_contents_file_put_contents_error.phpt | 2 +- .../stream_get_contents_negative_length.phpt | 2 +- ext/zlib/zlib.stub.php | 4 +- ext/zlib/zlib_arginfo.h | 4 +- 20 files changed, 99 insertions(+), 108 deletions(-) diff --git a/ext/bz2/bz2.stub.php b/ext/bz2/bz2.stub.php index d1d9928ebf..c1709e8b33 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 236d3e6dfc..83073c0de7 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/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt index aad575749b..ae9381ff1e 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-- -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 4c3f57729f..1adf9d59d8 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 09cb859ad7..c80c6a7ff1 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 819d0ee443..fdc73fe43b 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 132d4e0c6e..876cbb3fdb 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 359aab9ae9..f1c7e9ddc2 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 diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 5d7caf8ca8..ec97181854 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 47a00ca979..6af3931ad4 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 8e29847d8c..12ddfc73f5 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 a58308d831..d47efa26a1 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 c41a826bf9..9a576bd26c 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/standard/tests/streams/stream_get_contents_negative_length.phpt b/ext/standard/tests/streams/stream_get_contents_negative_length.phpt index d229c0ef6b..a12b98422c 100644 --- a/ext/standard/tests/streams/stream_get_contents_negative_length.phpt +++ b/ext/standard/tests/streams/stream_get_contents_negative_length.phpt @@ -16,4 +16,4 @@ try { ?> --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 diff --git a/ext/zlib/zlib.stub.php b/ext/zlib/zlib.stub.php index e03a9e5595..fdb7e7c8ef 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 3f9eb40809..76b966093d 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 -- 2.40.0