Skip to content

Commit

Permalink
Restore PHP 7.0 compatibility
Browse files Browse the repository at this point in the history
The offset parameter to unpack() was added in PHP 7.1, see
https://www.php.net/unpack
  • Loading branch information
thekid committed Aug 17, 2024
1 parent 10aff24 commit 613264f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/php/com/amazon/aws/api/EventStream.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,36 +75,36 @@ private function headers($buffer) {
break;

case self::SHORT:
$value= unpack('n', $buffer, $offset)[1];
$value= unpack('n', substr($buffer, $offset, 2))[1];
$offset+= 2;
break;

case self::INTEGER:
$value= unpack('N', $buffer, $offset)[1];
$value= unpack('N', substr($buffer, $offset, 4))[1];
$offset+= 4;
break;

case self::LONG:
$value= unpack('J', $buffer, $offset)[1];
$value= unpack('J', substr($buffer, $offset, 8))[1];
$offset+= 8;
break;

case self::BYTES:
$l= unpack('n', $buffer, $offset)[1];
$l= unpack('n', substr($buffer, $offset, 2))[1];
$offset+= 2;
$value= new Bytes(substr($buffer, $offset, $l));
$offset+= $l;
break;

case self::STRING:
$l= unpack('n', $buffer, $offset)[1];
$l= unpack('n', substr($buffer, $offset, 2))[1];
$offset+= 2;
$value= substr($buffer, $offset, $l);
$offset+= $l;
break;

case self::TIMESTAMP:
$t= unpack('J', $buffer, $offset)[1];
$t= unpack('J', substr($buffer, $offset, 8))[1];
$value= new Date((int)($t / 1000));
$offset+= 8;
break;
Expand Down

0 comments on commit 613264f

Please sign in to comment.