Skip to content

Commit

Permalink
Fixed reading varInt (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
norberttech authored Nov 6, 2023
1 parent 2779821 commit d795d97
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ public function readVarInt() : int
$shift = 0;

do {
$byte = $this->readBytes(1)->toArray()[0];
$bytes = $this->readBytes(1);

if ($bytes->count() === 0) {
break;
}

$byte = $bytes->toArray()[0];
$result |= ($byte & 0x7F) << $shift;
$shift += 7;
} while ($byte >= 0x80);
Expand Down

0 comments on commit d795d97

Please sign in to comment.