facebook / facebook/hhvm

socket_read() doesn't work using the PHP_NORMAL_READ option

Offen
#4,799 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
php5 incompatibility
Vorherrschende Sprache
C++
Sterne
18.7k
Forks
3.1k
Ø Merge
1 Std. 47 Min.
Gemergte PRs (30 T.)
2

Beschreibung

The socket_read() generates the following error when used with the PHP_NORMAL_READ option:
`Warning: unable to read from socket [2]: No such file or directory in some/path/server.php line 45`

Script used:

``` php
$client) {
if (in_array($client, $read)) {
if (($buffer = socket_read($client, 1024, PHP_NORMAL_READ)) === false) {
unset($clients[$key]);
echo socket_strerror(socket_last_error($client)) . "\n";
}
var_dump($buffer);
}
}
} while (true);

socket_close($sock);
?>
```

You can reproduce the bug by executing the following commands in two different terminals.
Terminal 1:
php server.php

Terminal 2:
nc localhost 10000

Result:

```
Warning: unable to read from socket [2]: No such file or directory in some/path/server.php line 45
No such file or directory
bool(false)
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.