Check if socket is resource before reading (#802)

This commit is contained in:
streamingsystems
2022-09-18 17:01:02 -05:00
committed by GitHub
parent 7ad74217c2
commit 42c33a406f
+1 -1
View File
@@ -304,7 +304,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.');