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); 24stream_socket_recvfrom($server, 1, 0, $peer); 25stream_socket_sendto($server, $data, 0, $peer); 26$ret = stream_get_contents($fd, 65565); 27var_dump(strlen($ret) > 0); 28stream_socket_shutdown($fd, STREAM_SHUT_RDWR); 29stream_socket_shutdown($server, STREAM_SHUT_RDWR); 30?> 31--EXPECT-- 32bool(true) 33