stream_get_contents() doesn't read the whole response
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
### HHVM Version
HipHop VM 3.12.1 (rel)
Compiler: tags/HHVM-3.12.1-0-gf516f1bb9046218f89885a220354c19dda6d8f4d
Repo schema: f2e5f39b2ad4a08bcbd90b5d8bcb580f40fba6c8
### Standalone code, or other way to reproduce the problem
server.php
``` php
$stream = stream_socket_server('0.0.0.0:8888', $errorCode, $errorMessage);
if (!$stream) {
die($errorMessage);
}
$conn = stream_socket_accept($stream);
$len = 1024 * 1024;
$data = str_repeat('x', $len);
fwrite($conn, $data, $len);
fclose($conn);
fclose($stream);
```
client.php
``` php
$stream = stream_socket_client('0.0.0.0:8888', $errorCode, $errorMessage, 3.0);
if (!$stream) {
die($errorMessage);
}
$data = stream_get_contents($stream, 1024 * 1024);
var_dump(strlen($data));
```
### Expected result
``` sh
$ php tests/socket/server.php &
$ php tests/socket/client.php
int(1048576)
[1]+ Done php tests/socket/server.php
```
### Actual result
``` sh
$ hhvm tests/socket/server.php &
$ hhvm tests/socket/client.php
int(8192)
[1]+ Done hhvm tests/socket/server.php
```
Contributor guide
Assessment
This issue has not been assessed yet.