1--TEST--
2socket_import_stream: Basic test
3--EXTENSIONS--
4sockets
5--FILE--
6<?php
7
8$domain = (strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? STREAM_PF_INET : STREAM_PF_UNIX);
9$s = stream_socket_pair($domain, STREAM_SOCK_STREAM, 0);
10
11$s0 = reset($s);
12$s1 = next($s);
13
14$sock = socket_import_stream($s0);
15var_dump($sock);
16socket_write($sock, "test message");
17socket_close($sock);
18
19var_dump(stream_get_contents($s1));
20?>
21--EXPECTF--
22object(Socket)#%d (0) {
23}
24string(12) "test message"
25