Check resource before reading (#803)

This commit is contained in:
Stefano Borghi
2022-09-20 09:13:12 -07:00
committed by GitHub
parent b000013f22
commit dc14604f3e
+1 -1
View File
@@ -333,7 +333,7 @@ class StreamConnection extends AbstractConnection
$bytesLeft = ($size += 2);
do {
$chunk = fread($socket, min($bytesLeft, 4096));
$chunk = is_resource($socket) ? fread($socket, min($bytesLeft, 4096)) : false;
if ($chunk === false || $chunk === '') {
$this->onConnectionError('Error while reading bytes from the server.');