Skip to content

Commit

Permalink
unpack returns an array
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Mar 31, 2010
1 parent acdf5d1 commit 1333a1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/openpgp.php
Expand Up @@ -222,7 +222,7 @@ static function parse_new_format($input) {
return array($tag, 3, (($len - 192) << 8) + ord($input[2]) + 192); return array($tag, 3, (($len - 192) << 8) + ord($input[2]) + 192);
} }
if($len == 255) { // Five octet length if($len == 255) { // Five octet length
return array($tag, 6, unpack('N', substr($input, 2, 4))); return array($tag, 6, array_pop(unpack('N', substr($input, 2, 4))));
} }
// TODO: Partial body lengths. 1 << ($len & 0x1F) // TODO: Partial body lengths. 1 << ($len & 0x1F)
} }
Expand Down Expand Up @@ -427,7 +427,7 @@ static function get_subpacket(&$input) {
} }
if($len == 255) { // Five octet length if($len == 255) { // Five octet length
$length_of_length = 5; $length_of_length = 5;
$len = unpack('N', substr($input, 1, 4)); $len = array_pop(unpack('N', substr($input, 1, 4)));
} }
$input = substr($input, $length_of_length); // Chop off length header $input = substr($input, $length_of_length); // Chop off length header
$tag = ord($input[0]); $tag = ord($input[0]);
Expand Down

0 comments on commit 1333a1a

Please sign in to comment.