Skip to content

Commit 6c5f436

Browse files
committed
add test case
1 parent 695861e commit 6c5f436

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ext/sockets/tests/socket_set_option_timeo_error.phpt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ $options_1 = array("sec" => 1, "usec" => "aaaaa");
1212
$options_2 = array("sec" => new stdClass(), "usec" => "1");
1313
$options_3 = array("l_onoff" => "aaaa", "l_linger" => "1");
1414
$options_4 = array("l_onoff" => "1", "l_linger" => []);
15+
$options_5 = array("l_onoff" => PHP_INT_MAX, "l_linger" => "1");
1516

1617
try {
1718
socket_set_option( $socket, SOL_SOCKET, SO_RCVTIMEO, new stdClass);
@@ -45,11 +46,17 @@ try {
4546
} catch (\TypeError $e) {
4647
echo $e->getMessage() . PHP_EOL;
4748
}
49+
try {
50+
socket_set_option( $socket, SOL_SOCKET, SO_LINGER, $options_5);
51+
} catch (\ValueError $e) {
52+
echo $e->getMessage() . PHP_EOL;
53+
}
4854
?>
49-
--EXPECT--
55+
--EXPECTF--
5056
socket_set_option(): Argument #4 ($value) must be of type array, stdClass given
5157
socket_set_option(): Argument #4 ($value) "usec" must be of type int, string given
5258
socket_set_option(): Argument #4 ($value) "sec" must be of type int, stdClass given
5359
socket_set_option(): Argument #4 ($value) must be of type array, string given
5460
socket_set_option(): Argument #4 ($value) "l_onoff" must be of type int, string given
5561
socket_set_option(): Argument #4 ($value) "l_linger" must be of type int, array given
62+
socket_set_option(): Argument #4 ($value) "l_onoff" must be between 0 and %d

0 commit comments

Comments
 (0)