We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7cf5b4c commit 231b8d9Copy full SHA for 231b8d9
src/Packer/PacketLength.php
@@ -28,10 +28,13 @@ public static function pack(int $length) : string
28
29
public static function unpack(string $data) : int
30
{
31
- if (false === $data = @\unpack('C/N', $data)) {
+ if (!isset($data[4]) || "\xce" !== $data[0]) {
32
throw new \RuntimeException('Unable to unpack packet length.');
33
}
34
35
- return $data[1];
+ return \ord($data[1]) << 24
36
+ | \ord($data[2]) << 16
37
+ | \ord($data[3]) << 8
38
+ | \ord($data[4]);
39
40
0 commit comments