1--TEST--
2stream_copy_to_stream() with socket as $source
3--SKIPIF--
4<?php
5$sockets = @stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
6if (!$sockets) die("skip stream_socket_pair");
7?>
8--FILE--
9<?php
10
11$sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
12$tmp = tmpfile();
13
14fwrite($sockets[0], b"a");
15stream_socket_shutdown($sockets[0], STREAM_SHUT_WR);
16stream_copy_to_stream($sockets[1], $tmp);
17
18fseek($tmp, 0, SEEK_SET);
19var_dump(stream_get_contents($tmp));
20
21stream_copy_to_stream($sockets[1], $tmp);
22
23fseek($tmp, 0, SEEK_SET);
24var_dump(stream_get_contents($tmp));
25
26
27?>
28--EXPECT--
29string(1) "a"
30string(1) "a"
31