We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc9b716 commit 6f1b8caCopy full SHA for 6f1b8ca
ext/sockets/sockets.c
@@ -951,8 +951,14 @@ PHP_FUNCTION(socket_close)
951
PHP_STREAM_FREE_KEEP_RSRC | PHP_STREAM_FREE_CLOSE |
952
(stream->is_persistent?PHP_STREAM_FREE_CLOSE_PERSISTENT:0));
953
}
954
- ZVAL_UNDEF(&php_socket->zstream);
+ } else {
955
+ if (!IS_INVALID_SOCKET(php_socket)) {
956
+ close(php_socket->bsd_socket);
957
+ }
958
959
+
960
+ ZVAL_UNDEF(&php_socket->zstream);
961
+ php_socket->bsd_socket = -1;
962
963
/* }}} */
964
ext/sockets/tests/socket_export_stream-1.phpt
@@ -20,7 +20,7 @@ var_dump($stream);
20
socket_write($s1, "test message");
21
socket_close($s1);
22
23
-//var_dump(stream_get_contents($stream));
+var_dump(stream_get_contents($stream));
24
--EXPECTF--
25
resource(%d) of type (stream)
26
string(12) "test message"
0 commit comments