Skip to content

Update ext/sockets parameter names #6276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/bz2/bz2.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ext/bz2/bz2_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/tests/fgc_edgecases.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php
Expand Down
66 changes: 33 additions & 33 deletions ext/sockets/sockets.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ext/date uses $second (and $microseconds), so we should syncronize these. I'd naturally use $seconds too, but I have no idea about the best solution (e.g. $hours sounds bad).

Copy link
Member Author

@nikic nikic Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the relevant difference between the ext/date usage and other usages is that ext/date uses $second in something like mktime($hour, $minute, $second, $day, $month, $year), where a point in time is assembled from components. In this case, using the singular makes sense. Outside ext/date, $seconds is generally used to describe a time interval for a timeout, in which case the plural makes sense. It's the difference between "at which second" and "how many seconds".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I digged into the Python manual for inspiration again, and found that they always use the plural form: https://docs.python.org/3/library/datetime.html#timedelta-objects So probably $hours is not that bad :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the difference between "at which second" and "how many seconds".

Aha, I see now! I wouldn't have noticed this difference.


function socket_create_listen(int $port, int $backlog = 128): Socket|false {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to suggest the usage of $max_connections instead of $backlog, but found out it's an stablished term. What a pity ^^


Expand All @@ -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 $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 {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering before if our $length and $max_length usages are really consistent. E.g. the manual says here Up to len bytes will be fetched from remote host so it seems it could also be $max_length.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been wondering about this as well. I think it might make sense to make all of these use just $length, unless they have some non-standard meaning (e.g. in the zlib case, where "max length" refers to a limit on the decoded payload size).

Copy link
Member

@kocsismate kocsismate Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might make sense to make all of these use just $length

Yes, it's what I also thought about proposing before, but I wasn't sure if it's the preferable thing to do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done this now. Everything uses just $length now, apart from zlib uncompression:

ext/zlib/zlib.stub.php:function zlib_decode(string $data, int $max_length = 0): string|false {}
ext/zlib/zlib.stub.php:function gzinflate(string $data, int $max_length = 0): string|false {}
ext/zlib/zlib.stub.php:function gzdecode(string $data, int $max_length = 0): string|false {}
ext/zlib/zlib.stub.php:function gzuncompress(string $data, int $max_length = 0): string|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 {}
Expand All @@ -95,22 +95,22 @@ 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 {}
function socket_wsaprotocol_info_export(Socket $socket, int $process_id): string|false {}

function socket_wsaprotocol_info_import(string $info_id): Socket|false {}

Expand Down
66 changes: 33 additions & 33 deletions ext/sockets/sockets_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: f35790f5f703b37c45230e97e8f0ee736727b4bd */
* 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_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)
Expand Down Expand Up @@ -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(0, data, IS_STRING, 0)
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)
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()

Expand All @@ -61,65 +61,65 @@ 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

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
Expand All @@ -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

Expand All @@ -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)
Expand All @@ -181,19 +181,19 @@ 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)
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

Expand Down
4 changes: 2 additions & 2 deletions ext/sockets/tests/mcast_ipv4_send_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ 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"
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)
2 changes: 1 addition & 1 deletion ext/sockets/tests/socket_select_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ext/sockets/tests/socket_send_params.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ext/sockets/tests/socket_sendto_params.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions ext/sockets/tests/socket_set_option_rcvtimeo.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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, [email protected]
PHP Testfest Berlin 2009-05-10
Loading