hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

socket_read() - PHP_NORMAL_READ not works

Open louisehu opened this issue 15 years ago • 1 comments

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

louisehu avatar Nov 01 '11 14:11 louisehu

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:

  1. Give detailed repro steps
  2. Write a test case in hphp/tests/quick (run it with hphp/tests/run) and send the pull request
  3. Fix it in a pull request

ptarjan avatar May 13 '13 21:05 ptarjan