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