Skip to content

Commit 36d95d5

Browse files
Merge pull request #4 from stefanak-michal/bug/2_bigint
fixed bigint order to get proper value
2 parents 5261176 + 7c1e182 commit 36d95d5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Unpacker.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,13 @@ private function unpackInteger(int $marker, bool &$result = false): int
379379
$output = unpack('c', $this->next(1))[1] ?? 0;
380380
} elseif ($marker == 0xC9) { //INT_16
381381
$value = $this->next(2);
382-
$value = $little ? strrev($value) : $value;
383-
$output = unpack('s', $value)[1] ?? 0;
382+
$output = unpack('s', $little ? strrev($value) : $value)[1] ?? 0;
384383
} elseif ($marker == 0xCA) { //INT_32
385384
$value = $this->next(4);
386-
$value = $little ? strrev($value) : $value;
387-
$output = unpack('l', $value)[1] ?? 0;
385+
$output = unpack('l', $little ? strrev($value) : $value)[1] ?? 0;
388386
} elseif ($marker == 0xCB) { //INT_64
389-
$output = unpack('q', $this->next(8))[1] ?? 0;
387+
$value = $this->next(8);
388+
$output = unpack("q", $little ? strrev($value) : $value)[1] ?? 0;
390389
}
391390

392391
if ($output !== null) {

0 commit comments

Comments
 (0)