// Extract the values
//$data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $binaryData);
- $data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155prefix", $binaryData);
+ if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ $format = 'Z100filename/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/Z32uname/Z32gname/Z8devmajor/Z8devminor/Z155prefix';
+ }
+ else {
+ $format = 'a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155prefix';
+ }
+
+ $data = unpack($format, $binaryData);
// Extract the properties
$header['checksum'] = octDec(trim($data['checksum']));
$longFilename = null;
}
if ($header['typeflag'] == 'L') {
- $fileData = unpack("a".$header['size']."filename", $this->file->read(512));
+ if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ $format = 'Z'.$header['size'].'filename';
+ }
+ else {
+ $format = 'a'.$header['size'].'filename';
+ }
+
+ $fileData = unpack($format, $this->file->read(512));
$longFilename = $fileData['filename'];
$header['size'] = 0;
}
}
// extract values
- $data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155prefix", $binaryData);
+ if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ $format = 'Z100filename/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/Z32uname/Z32gname/Z8devmajor/Z8devminor/Z155prefix';
+ }
+ else {
+ $format = 'a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155prefix';
+ }
+
+ $data = unpack($format, $binaryData);
// Extract the properties
$header['checksum'] = octDec(trim($data['checksum']));