Skip to content

Commit 3dbabb9

Browse files
committed
Fix Stream::read($length) implementation
When `$length` value exceeds the stream eof, the remaining stream content must be returned.
1 parent 25407e7 commit 3dbabb9

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)