1--TEST--
2Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows
3--SKIPIF--
4<?php
5if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
6if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }
7?>
8--FILE--
9<?php
10$port = 12327;
11$server = false;
12while(!$server && $port < 20000){
13    $port++;
14    $server = stream_socket_server("udp://localhost:$port", $errno, $errstr, STREAM_SERVER_BIND);
15}
16if(!$server){
17    var_dump(false);
18    die("Cannot create server socket");
19}
20$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
21$fd = stream_socket_client("udp://localhost:$port", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
22stream_set_blocking($fd, 0);
23stream_socket_sendto($fd, $data);
24$read = array($server);
25$write = null;
26$exc = null;
27if (stream_select($read, $write, $exc, 0, 250000) === false) die ("stream_select timeout");
28stream_socket_recvfrom($server, 1, 0, $peer);
29stream_socket_sendto($server, $data, 0, $peer);
30$read = array($fd);
31if (stream_select($read, $write, $exc, 0, 250000) === false) die ("stream_select timeout");
32$ret = stream_get_contents($fd, 65565);
33var_dump(strlen($ret) > 0);
34stream_socket_shutdown($fd, STREAM_SHUT_RDWR);
35stream_socket_shutdown($server, STREAM_SHUT_RDWR);
36?>
37--EXPECT--
38bool(true)
39