Skip to content

Commit f1146ee

Browse files
added unpacking boolean
1 parent 54d200a commit f1146ee

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Unpacker.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ private function u()
7777
if ($result) {
7878
return $output;
7979
}
80+
$output = $this->unpackBoolean($marker, $result);
81+
if ($result) {
82+
return $output;
83+
}
8084
$output = $this->unpackFloat($marker, $result);
8185
if ($result) {
8286
return $output;
@@ -320,6 +324,23 @@ private function unpackMap(int $marker, bool &$result = false): array
320324

321325
return $output;
322326
}
327+
328+
/**
329+
* @param int $marker
330+
* @param bool $result
331+
* @return bool
332+
*/
333+
private function unpackBoolean(int $marker, bool &$result = false): bool
334+
{
335+
if ($marker == 0xC3) {
336+
$result = true;
337+
return true;
338+
} elseif ($marker == 0xC2) {
339+
$result = true;
340+
return false;
341+
}
342+
return false;
343+
}
323344

324345
/**
325346
* @param int $marker

0 commit comments

Comments
 (0)