diff --git a/src/Stream.php b/src/Stream.php index 0c059ca..afe6dd6 100644 --- a/src/Stream.php +++ b/src/Stream.php @@ -155,9 +155,14 @@ public function isReadable(): bool */ public function read($length): string { + if (0 === $length) { + return ''; + } + if ($this->isDetached || null === $this->socket) { throw new StreamException('Stream is detached'); } + if (null === $this->getSize()) { $read = fread($this->socket, $length); if (false === $read) {