hhvm
hhvm copied to clipboard
socket_read() - PHP_NORMAL_READ not works
My test server listening on port 20099 at localhost, and send following text to connected clients: "Dolly".
Following code try to connect to test server, but unable to do it with hphp compiled binary. Same code works with PHP and hphp interpreters.
$socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if($socket) {
$ret = socket_connect($socket, "127.0.0.1", "20099");
if($ret){
$data = socket_read($socket, 8192, PHP_NORMAL_READ);
echo $data."\n";
}
socket_close($socket);
}
HipHop message:
HipHop Warning: unable to read from socket [2]: No such file or directory in test_socket.php on line 6
Traced function calls of hphp compiled code:
[pid 12591] connect(26, {sa_family=AF_INET, sin_port=htons(20099), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
[pid 12591] fcntl(26, F_GETFL) = 0x2 (flags O_RDWR)
[pid 12591] recvfrom(26, "D", 1, 0, NULL, NULL) = 1
[pid 12591] write(2, "HipHop Warning: unable to read "..., 117) = 117
[pid 12591] close(26) = 0
We're closing out all bugs older than 2 months. http://www.hiphop-php.com/wp/?p=575
If this is still an issue, please re-open it, and in order of goodness:
- Give detailed repro steps
- Write a test case in hphp/tests/quick (run it with hphp/tests/run) and send the pull request
- Fix it in a pull request