Skip to content

Commit

Permalink
Only read the stream if the length > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
akrabat committed Jun 8, 2024
1 parent ad89d92 commit d7b6767
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public function read($length): string
{
$data = false;

if ($this->isReadable() && $this->stream && $length >= 0) {
if ($this->isReadable() && $this->stream && $length > 0) {
$data = fread($this->stream, $length);
}

Expand Down

0 comments on commit d7b6767

Please sign in to comment.