--- /dev/null
+--TEST--\r
+Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows\r
+--SKIPIF--\r
+<?php\r
+if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }\r
+if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }\r
+?>\r
+--FILE--\r
+<?php\r
+$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");\r
+$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);\r
+stream_set_blocking($fd, 0);\r
+stream_socket_sendto($fd,$data);\r
+sleep(1);\r
+$ret = stream_get_contents($fd,65565);\r
+var_dump(strlen($ret) > 0);\r
+stream_socket_shutdown($fd,STREAM_SHUT_RDWR);\r
+?>\r
+==DONE==\r
+--EXPECTF--\r
+bool(true)\r
+==DONE==\r
# undef EWOULDBLOCK
# endif
# define EWOULDBLOCK WSAEWOULDBLOCK
+# ifdef EMSGSIZE
+# undef EMSGSIZE
+# endif
+# define EMSGSIZE WSAEMSGSIZE
#endif
/* This functions transforms the first char to 'w' if it's not 'r', 'a' or 'w'
ret = recv(sock->socket, &buf, sizeof(buf), MSG_PEEK);
err = php_socket_errno();
if (0 == ret || /* the counterpart did properly shutdown*/
- (0 > ret && err != EWOULDBLOCK && err != EAGAIN)) { /* there was an unrecoverable error */
+ (0 > ret && err != EWOULDBLOCK && err != EAGAIN && err != EMSGSIZE)) { /* there was an unrecoverable error */
alive = 0;
}
}