Skip to content

Commit baa9132

Browse files
committed
Fix GH-12104 attempt
using stream_select to gives the chance to process the data.
1 parent 04c9749 commit baa9132

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/standard/tests/streams/bug74090.phpt

+6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ $data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
2121
$fd = stream_socket_client("udp://localhost:$port", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
2222
stream_set_blocking($fd, 0);
2323
stream_socket_sendto($fd, $data);
24+
$read = array($server);
25+
$write = null;
26+
$exc = null;
27+
if (stream_select($read, $write, $exc, 0, 250000) === false) die ("stream_select timeout");
2428
stream_socket_recvfrom($server, 1, 0, $peer);
2529
stream_socket_sendto($server, $data, 0, $peer);
30+
$read = array($fd);
31+
if (stream_select($read, $write, $exc, 0, 250000) === false) die ("stream_select timeout");
2632
$ret = stream_get_contents($fd, 65565);
2733
var_dump(strlen($ret) > 0);
2834
stream_socket_shutdown($fd, STREAM_SHUT_RDWR);

0 commit comments

Comments
 (0)