socket_read() doesn't work using the PHP_NORMAL_READ option
- Lenguaje dominante
- C++
- Estrellas
- 18.7k
- Forks
- 3.1k
- Merge medio
- 1 h 47 min
- PR fusionados (30 d)
- 2
Descripción
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)
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.