From fa66f8766aab6dc24cececfc3f697f16c6d9302c Mon Sep 17 00:00:00 2001 From: t3ran13 Date: Sun, 18 Feb 2018 22:08:51 +0300 Subject: [PATCH] - fix critical bag for funcs writeVString* have to be used unsigned char for unpack --- src/t3ran13/ByteBuffer/ByteBuffer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/t3ran13/ByteBuffer/ByteBuffer.php b/src/t3ran13/ByteBuffer/ByteBuffer.php index 7ff9b12..f87f14c 100644 --- a/src/t3ran13/ByteBuffer/ByteBuffer.php +++ b/src/t3ran13/ByteBuffer/ByteBuffer.php @@ -131,7 +131,7 @@ public function writeVStringLE($value, $offset = null) { if ($offset === null) { $offset = $this->currentOffset; } - $bytes = unpack('c*', $value); //string to bytes in int + $bytes = unpack('C*', $value); //string to bytes in int $total = count($bytes); for ($i = 0; $i < $total; $i++) { $this->buffer[$offset++] = pack('H*', base_convert($bytes[$i+1], 10, 16)); @@ -156,7 +156,7 @@ public function writeVStringBE($value, $offset = null) { if ($offset === null) { $offset = $this->currentOffset; } - $bytes = unpack('c*', $value); //string to bytes in int + $bytes = unpack('C*', $value); //string to bytes in int $total = count($bytes); for ($i = 0; $i < $total; $i++) { $this->buffer[$offset++] = pack('h*', base_convert($bytes[$i+1], 10, 16));