1--TEST--
2socket_import_stream: Bad arguments
3--EXTENSIONS--
4sockets
5--FILE--
6<?php
7
8var_dump(socket_import_stream(fopen(__FILE__, "rb")));
9try {
10    socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP));
11} catch (TypeError $e) {
12    echo $e->getMessage(), "\n";
13}
14$s = stream_socket_server("udp://127.0.0.1:0", $errno, $errstr, STREAM_SERVER_BIND);
15var_dump($s);
16var_dump(fclose($s));
17try {
18    socket_import_stream($s);
19} catch (TypeError $e) {
20    echo $e->getMessage(), "\n";
21}
22
23echo "Done.";
24?>
25--EXPECTF--
26Warning: socket_import_stream(): Cannot represent a stream of type STDIO as a Socket Descriptor in %s on line %d
27bool(false)
28socket_import_stream(): Argument #1 ($stream) must be of type resource, Socket given
29resource(%d) of type (stream)
30bool(true)
31socket_import_stream(): supplied resource is not a valid stream resource
32Done.
33