Skip to content

Commit 8771c26

Browse files
committed
Fix test on Windows.
Windows complains of invalid parameters because the socket is not bound. The test expected the error to be EAGAIN/EWOULDBLOCK. Moved the call down, after the socket is bound.
1 parent a000920 commit 8771c26

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎ext/sockets/tests/socket_sentto_recvfrom_ipv4_udp.phpt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ if (!extension_loaded('sockets')) {
1414
if (!socket_set_nonblock($socket)) {
1515
die('Unable to set nonblocking mode for socket');
1616
}
17-
var_dump(socket_recvfrom($socket, $buf, 12, 0, $from, $port)); //false (EAGAIN - no warning)
17+
1818
$address = '127.0.0.1';
1919
socket_sendto($socket, '', 1, 0, $address); // cause warning
2020
if (!socket_bind($socket, $address, 1223)) {
2121
die("Unable to bind to $address:1223");
2222
}
23+
24+
var_dump(socket_recvfrom($socket, $buf, 12, 0, $from, $port)); //false (EAGAIN - no warning)
2325

2426
$msg = "Ping!";
2527
$len = strlen($msg);
@@ -44,9 +46,9 @@ if (!extension_loaded('sockets')) {
4446

4547
socket_close($socket);
4648
--EXPECTF--
47-
bool(false)
4849

4950
Warning: Wrong parameter count for socket_sendto() in %s on line %d
51+
bool(false)
5052

5153
Warning: socket_recvfrom() expects at least 5 parameters, 4 given in %s on line %d
5254

0 commit comments

Comments
 (0)