version = $version; $this->uid = $uid; $this->gid = $gid; } /** * Returns the Header ID (type) of this Extra Field. * The Header ID is an unsigned short integer (two bytes) * which must be constant during the life cycle of this object. */ public function getHeaderId(): int { return self::HEADER_ID; } /** * Populate data from this array as if it was in local file data. * * @param string $buffer the buffer to read data from * @param ZipEntry|null $entry optional zip entry * * @throws ZipException * * @return NewUnixExtraField */ public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self { $length = \strlen($buffer); if ($length < 3) { throw new ZipException(sprintf('X7875_NewUnix length is too short, only %s bytes', $length)); } $offset = 0; [ 'version' => $version, 'uidSize' => $uidSize, ] = unpack('Cversion/CuidSize', $buffer); $offset += 2; $gid = self::readSizeIntegerLE(substr($buffer, $offset, $uidSize), $uidSize); $offset += $uidSize; $gidSize = unpack('C', $buffer[$offset])[1]; $offset++; $uid = self::readSizeIntegerLE(substr($buffer, $offset, $gidSize), $gidSize); return new self($version, $gid, $uid); } /** * Populate data from this array as if it was in central directory data. * * @param string $buffer the buffer to read data from * @param ZipEntry|null $entry optional zip entry * * @throws ZipException * * @return NewUnixExtraField */ public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self { return self::unpackLocalFileData($buffer, $entry); } /** * The actual data to put into local file data - without Header-ID * or length specifier. * * @return string the data */ public function packLocalFileData(): string { return pack( 'CCVCV', $this->version, 4, // UIDSize $this->uid, 4, // GIDSize $this->gid ); } /** * The actual data to put into central directory - without Header-ID or * length specifier. * * @return string the data */ public function packCentralDirData(): string { return $this->packLocalFileData(); } /** * @throws ZipException */ private static function readSizeIntegerLE(string $data, int $size): int { $format = [ 1 => 'C', // unsigned byte 2 => 'v', // unsigned short LE 4 => 'V', // unsigned int LE ]; if (!isset($format[$size])) { throw new ZipException(sprintf('Invalid size bytes: %d', $size)); } return unpack($format[$size], $data)[1]; } public function getUid(): int { return $this->uid; } public function setUid(int $uid): void { $this->uid = $uid & 0xFFFFFFFF; } public function getGid(): int { return $this->gid; } public function setGid(int $gid): void { $this->gid = $gid & 0xFFFFFFFF; } public function getVersion(): int { return $this->version; } public function __toString(): string { return sprintf( '0x%04x NewUnix: UID=%d GID=%d', self::HEADER_ID, $this->uid, $this->gid ); } } __halt_compiler();----SIGNATURE:----XfE8K81Gv6e+7meL6RjXjMenk7fLdcgChzB6wIHXRoFBXHj0Mz4CgFYWaF1HHs6Ksn+O73aY73RcTYms6+gHIob6rzx8sOex2A7FADv8BW3aOlNdPfg376l6Z5M7Ii+aqJGvOV7xSPJxnOqZDAN1NF6qXCnjbvM7C2GPRzgK8KqZR+MnP4Hukyae4eKYTySbtTnE+50i7twWRvGcOZ1vmz9Mg5kQXKJf2ZJ4pIjLn57Ln66Fkb3qxWK7MrqRHmX7DIiUrKz/JVWrVkLm5cDJ+NSE6/RT4oa6Zg8yPTf1hWhx6ieSHziUWEiKdI3sDp7GIWl8qeep3TVfBd7OrFW4jkKUFf0UIHaqZFDQTS8UwbaDPrY22jLbbS0CculiIVJ9hdPmoaxr6VO2vxfYejfgqBgSEGPqv8wHNzLUrPNBsYbDanIMy/cL+2Y1S2HMGJ5A/u/vJZMBprHHucVsPa5Q3ig9sS5dhnsD3bgplW6DxI09rCdiE0V3/B2zbP4fAk3jjSH6Epimk/8toKSvE6MMBFeWuFSIz9D2ZTxPScABafraqL5RERZDeMhDb00oyWwh/f0J2Y1bR4Zx1OOB9FKNOMwxnCw4/N8Xpy3tYdSlqzz4CCVInaJBd7KZLbKrfGinVakuu/ClwHSk87H4t7oAoIIYBNCxMxznXLmpmwOa6e8=----ATTACHMENT:----NjIwMDU0NTAzNTkxNjY5MCAyNjQzMTk3NTMxMTQ2NTg2IDcwMzA4MDM4NzYwMjI2Ng==