1--TEST--
2socket_export_stream: Bad arguments
3--SKIPIF--
4<?php
5if (!extension_loaded('sockets')) {
6    die('SKIP sockets extension not available.');
7}
8--FILE--
9<?php
10
11try {
12    socket_export_stream(fopen(__FILE__, "rb"));
13} catch (TypeError $e) {
14    echo $e->getMessage(), "\n";
15}
16try {
17    socket_export_stream(stream_socket_server("udp://127.0.0.1:0", $errno, $errstr, STREAM_SERVER_BIND));
18} catch (TypeError $e) {
19    echo $e->getMessage(), "\n";
20}
21$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
22var_dump($s);
23socket_close($s);
24
25try {
26    var_dump(socket_export_stream($s));
27} catch (Error $e) {
28    echo $e->getMessage(), "\n";
29}
30
31echo "Done.";
32?>
33--EXPECTF--
34socket_export_stream(): Argument #1 ($socket) must be of type Socket, resource given
35socket_export_stream(): Argument #1 ($socket) must be of type Socket, resource given
36object(Socket)#%d (0) {
37}
38socket_export_stream(): Argument #1 ($socket) has already been closed
39Done.
40