Skip to content

Commit d1b19e7

Browse files
committed
Use SOL_TCP as this is how the extension exposes the const to userland
1 parent 9eaac69 commit d1b19e7

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
--TEST--
2-
socket_set_option($socket, IPPROTO_TCP, TCP_CONGESTION, INVALID_TYPE_FOR_OPTION)
2+
socket_set_option($socket, SOL_TCP, TCP_CONGESTION, INVALID_TYPE_FOR_OPTION)
33
--EXTENSIONS--
44
sockets
55
--SKIPIF--
66
<?php
77

8-
if (!defined('IPPROTO_TCP')) {
9-
die('skip IPPROTO_TCP not available.');
10-
}
118
if (!defined('TCP_CONGESTION')) {
129
die('skip TCP_CONGESTION not available.');
1310
}
@@ -21,7 +18,7 @@ if (!$socket) {
2118
}
2219

2320
try {
24-
$ret = socket_set_option($socket, IPPROTO_TCP, TCP_CONGESTION, new stdClass());
21+
$ret = socket_set_option($socket, SOL_TCP, TCP_CONGESTION, new stdClass());
2522
var_dump($ret);
2623
} catch (Throwable $e) {
2724
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
--TEST--
2-
socket_set_option($socket, IPPROTO_TCP, TCP_FUNCTION_BLK, INVALID_TYPE_FOR_OPTION)
2+
socket_set_option($socket, SOL_TCP, TCP_FUNCTION_BLK, INVALID_TYPE_FOR_OPTION)
33
--EXTENSIONS--
44
sockets
55
--SKIPIF--
66
<?php
77

8-
if (!defined('IPPROTO_TCP')) {
9-
die('skip IPPROTO_TCP not available.');
10-
}
118
if (!defined('TCP_FUNCTION_BLK')) {
129
die('skip TCP_FUNCTION_BLK not available.');
1310
}
@@ -21,19 +18,19 @@ if (!$socket) {
2118
}
2219

2320
try {
24-
$ret = socket_set_option($socket, IPPROTO_TCP, TCP_FUNCTION_BLK, new stdClass());
21+
$ret = socket_set_option($socket, SOL_TCP, TCP_FUNCTION_BLK, new stdClass());
2522
var_dump($ret);
2623
} catch (Throwable $e) {
2724
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
2825
}
2926
try {
30-
$ret = socket_set_option($socket, IPPROTO_TCP, TCP_FUNCTION_BLK, "string\0with\0null\0bytes");
27+
$ret = socket_set_option($socket, SOL_TCP, TCP_FUNCTION_BLK, "string\0with\0null\0bytes");
3128
var_dump($ret);
3229
} catch (Throwable $e) {
3330
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
3431
}
3532
try {
36-
$ret = socket_set_option($socket, IPPROTO_TCP, TCP_FUNCTION_BLK, str_repeat("a", 2048));
33+
$ret = socket_set_option($socket, SOL_TCP, TCP_FUNCTION_BLK, str_repeat("a", 2048));
3734
var_dump($ret);
3835
} catch (Throwable $e) {
3936
echo $e::class, ': ', $e->getMessage(), PHP_EOL;

0 commit comments

Comments
 (0)