Skip to content

Commit 8ab076d

Browse files
committed
Fix Stream::read($length) implementation
When `$length` value exceeds the stream eof, the remaining stream content must be returned.
1 parent 0d986fb commit 8ab076d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Stream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function read($length)
164164
}
165165

166166
if ($this->getSize() < ($this->readed + $length)) {
167-
throw new StreamException('Cannot read more than %s', $this->getSize() - $this->readed);
167+
return fread($this->socket, $this->getSize() - $this->readed);
168168
}
169169

170170
if ($this->getSize() === $this->readed) {

0 commit comments

Comments
 (0)