Skip to content

Commit 19e2e4d

Browse files
committed
Port stream bug51056 and gh11418 tests to use ephemeral ports
1 parent e0dabe3 commit 19e2e4d

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

ext/standard/tests/streams/bug51056.phpt

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Bug #51056 (fread() on blocking stream will block even if data is available)
44
<?php
55

66
$serverCode = <<<'CODE'
7-
$server = stream_socket_server('tcp://127.0.0.1:64327');
8-
phpt_notify();
7+
$server = stream_socket_server('tcp://127.0.0.1:0');
8+
phpt_notify_server_start($server);
99
1010
$conn = stream_socket_accept($server);
1111
@@ -21,9 +21,7 @@ CODE;
2121

2222
$clientCode = <<<'CODE'
2323
24-
phpt_wait();
25-
26-
$fp = fsockopen("tcp://127.0.0.1:64327");
24+
$fp = fsockopen("tcp://{{ ADDR }}");
2725
2826
while (!feof($fp)) {
2927
$data = fread($fp, 256);

ext/standard/tests/streams/gh11418.phpt

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ GH-11418: fgets on a redis socket connection fails on PHP 8.3
44
<?php
55

66
$serverCode = <<<'CODE'
7-
$server = stream_socket_server('tcp://127.0.0.1:64325');
8-
phpt_notify();
7+
$server = stream_socket_server('tcp://127.0.0.1:0');
8+
phpt_notify_server_start($server);
99
1010
$conn = stream_socket_accept($server);
1111
@@ -19,9 +19,7 @@ CODE;
1919

2020
$clientCode = <<<'CODE'
2121
22-
phpt_wait();
23-
24-
$fp = fsockopen("tcp://127.0.0.1:64325");
22+
$fp = fsockopen("tcp://{{ ADDR }}");
2523
2624
echo fread($fp, 3);
2725
echo fgets($fp);

0 commit comments

Comments
 (0)