Skip to content

Commit ae34a65

Browse files
committed
Fix Socket related tests on Windows
1 parent 2d32b63 commit ae34a65

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

ext/sockets/tests/socket_export_stream-4-win.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ function test($stream, $sock) {
1616
echo "stream_set_blocking ";
1717
try {
1818
print_r(stream_set_blocking($stream, 0));
19-
} catch (TypeError $e) {
20-
echo $e->getMessage(), "\n";
19+
} catch (Error $e) {
20+
echo get_class($e), ": ", $e->getMessage(), "\n";
2121
}
2222
echo "\n";
2323
}
2424
if ($sock !== null) {
2525
echo "socket_set_block ";
2626
try {
2727
print_r(socket_set_block($sock));
28-
} catch (TypeError $e) {
29-
echo $e->getMessage(), "\n";
28+
} catch (Error $e) {
29+
echo get_class($e), ": ", $e->getMessage(), "\n";
3030
}
3131
echo "\n";
3232
echo "socket_get_option ";
3333
try {
3434
print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
35-
} catch (TypeError $e) {
36-
echo $e->getMessage(), "\n";
35+
} catch (Error $e) {
36+
echo get_class($e), ": ", $e->getMessage(), "\n";
3737
}
3838
echo "\n";
3939
}
@@ -90,7 +90,7 @@ stream_set_blocking 1
9090

9191

9292
close stream
93-
stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
93+
stream_set_blocking TypeError: stream_set_blocking(): supplied resource is not a valid stream resource
9494

9595
socket_set_block
9696
Warning: socket_set_block(): unable to set blocking mode [%d]: An operation was attempted on something that is not a socket.
@@ -103,8 +103,8 @@ Warning: socket_get_option(): Unable to retrieve socket option [%d]: An operatio
103103

104104

105105
close socket
106-
stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
106+
stream_set_blocking TypeError: stream_set_blocking(): supplied resource is not a valid stream resource
107107

108-
socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
108+
socket_set_block Error: socket_set_block(): Argument #1 ($socket) has already been closed
109109

110-
socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
110+
socket_get_option Error: socket_get_option(): Argument #1 ($socket) has already been closed

ext/sockets/tests/socket_import_stream-4-win.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ function test($stream, $sock) {
1616
echo "stream_set_blocking ";
1717
try {
1818
print_r(stream_set_blocking($stream, 0));
19-
} catch (TypeError $e) {
20-
echo $e->getMessage(), "\n";
19+
} catch (Error $e) {
20+
echo get_class($e), ": ", $e->getMessage(), "\n";
2121
}
2222
echo "\n";
2323
}
2424
if ($sock !== null) {
2525
echo "socket_set_block ";
2626
try {
2727
print_r(socket_set_block($sock));
28-
} catch (TypeError $e) {
29-
echo $e->getMessage(), "\n";
28+
} catch (Error $e) {
29+
echo get_class($e), ": ", $e->getMessage(), "\n";
3030
}
3131
echo "\n";
3232
echo "socket_get_option ";
3333
try {
3434
print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
35-
} catch (TypeError $e) {
36-
echo $e->getMessage(), "\n";
35+
} catch (Error $e) {
36+
echo get_class($e), ": ", $e->getMessage(), "\n";
3737
}
3838
echo "\n";
3939
}
@@ -85,7 +85,7 @@ stream_set_blocking 1
8585

8686

8787
close stream
88-
stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
88+
stream_set_blocking TypeError: stream_set_blocking(): supplied resource is not a valid stream resource
8989

9090
socket_set_block
9191
Warning: socket_set_block(): unable to set blocking mode [10038]: %s
@@ -98,8 +98,8 @@ Warning: socket_get_option(): Unable to retrieve socket option [10038]: %s
9898

9999

100100
close socket
101-
stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
101+
stream_set_blocking TypeError: stream_set_blocking(): supplied resource is not a valid stream resource
102102

103-
socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
103+
socket_set_block Error: socket_set_block(): Argument #1 ($socket) has already been closed
104104

105-
socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
105+
socket_get_option Error: socket_get_option(): Argument #1 ($socket) has already been closed

ext/sockets/tests/wsaprotocol_info_0.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ object(Socket)#%d (0) {
5454
}
5555
object(Socket)#%d (0) {
5656
}
57-
resource(%d) of type (Unknown)
57+
object(Socket)#%d (0) {
58+
}
5859

5960
Warning: socket_wsaprotocol_info_export(): Unable to export WSA protocol info [0x00002726]: %s
6061
in %s on line %d

0 commit comments

Comments
 (0)