uncompressedSize = $uncompressedSize; $this->compressedSize = $compressedSize; $this->localHeaderOffset = $localHeaderOffset; $this->diskStart = $diskStart; } /** * 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 $entry * * @throws ZipException on error * * @return Zip64ExtraField */ public static function unpackLocalFileData(string $buffer, ?ZipEntry $entry = null): self { $length = \strlen($buffer); if ($length === 0) { // no local file data at all, may happen if an archive // only holds a ZIP64 extended information extra field // inside the central directory but not inside the local // file header return new self(); } if ($length < 16) { throw new ZipException( 'Zip64 extended information must contain both size values in the local file header.' ); } [ 'uncompressedSize' => $uncompressedSize, 'compressedSize' => $compressedSize, ] = unpack('PuncompressedSize/PcompressedSize', substr($buffer, 0, 16)); return new self($uncompressedSize, $compressedSize); } /** * Populate data from this array as if it was in central directory data. * * @param string $buffer the buffer to read data from * @param ?ZipEntry $entry * * @throws ZipException * * @return Zip64ExtraField */ public static function unpackCentralDirData(string $buffer, ?ZipEntry $entry = null): self { if ($entry === null) { throw new RuntimeException('zipEntry is null'); } $length = \strlen($buffer); $remaining = $length; $uncompressedSize = null; $compressedSize = null; $localHeaderOffset = null; $diskStart = null; if ($entry->getUncompressedSize() === ZipConstants::ZIP64_MAGIC) { if ($remaining < 8) { throw new ZipException('ZIP64 extension corrupt (no uncompressed size).'); } $uncompressedSize = unpack('P', substr($buffer, $length - $remaining, 8))[1]; $remaining -= 8; } if ($entry->getCompressedSize() === ZipConstants::ZIP64_MAGIC) { if ($remaining < 8) { throw new ZipException('ZIP64 extension corrupt (no compressed size).'); } $compressedSize = unpack('P', substr($buffer, $length - $remaining, 8))[1]; $remaining -= 8; } if ($entry->getLocalHeaderOffset() === ZipConstants::ZIP64_MAGIC) { if ($remaining < 8) { throw new ZipException('ZIP64 extension corrupt (no relative local header offset).'); } $localHeaderOffset = unpack('P', substr($buffer, $length - $remaining, 8))[1]; $remaining -= 8; } if ($remaining === 4) { $diskStart = unpack('V', substr($buffer, $length - $remaining, 4))[1]; } return new self($uncompressedSize, $compressedSize, $localHeaderOffset, $diskStart); } /** * The actual data to put into local file data - without Header-ID * or length specifier. * * @return string the data */ public function packLocalFileData(): string { if ($this->uncompressedSize !== null || $this->compressedSize !== null) { if ($this->uncompressedSize === null || $this->compressedSize === null) { throw new \InvalidArgumentException( 'Zip64 extended information must contain both size values in the local file header.' ); } return $this->packSizes(); } return ''; } private function packSizes(): string { $data = ''; if ($this->uncompressedSize !== null) { $data .= pack('P', $this->uncompressedSize); } if ($this->compressedSize !== null) { $data .= pack('P', $this->compressedSize); } return $data; } /** * The actual data to put into central directory - without Header-ID or * length specifier. * * @return string the data */ public function packCentralDirData(): string { $data = $this->packSizes(); if ($this->localHeaderOffset !== null) { $data .= pack('P', $this->localHeaderOffset); } if ($this->diskStart !== null) { $data .= pack('V', $this->diskStart); } return $data; } public function getUncompressedSize(): ?int { return $this->uncompressedSize; } public function setUncompressedSize(?int $uncompressedSize): void { $this->uncompressedSize = $uncompressedSize; } public function getCompressedSize(): ?int { return $this->compressedSize; } public function setCompressedSize(?int $compressedSize): void { $this->compressedSize = $compressedSize; } public function getLocalHeaderOffset(): ?int { return $this->localHeaderOffset; } public function setLocalHeaderOffset(?int $localHeaderOffset): void { $this->localHeaderOffset = $localHeaderOffset; } public function getDiskStart(): ?int { return $this->diskStart; } public function setDiskStart(?int $diskStart): void { $this->diskStart = $diskStart; } public function __toString(): string { $args = [self::HEADER_ID]; $format = '0x%04x ZIP64: '; $formats = []; if ($this->uncompressedSize !== null) { $formats[] = 'SIZE=%d'; $args[] = $this->uncompressedSize; } if ($this->compressedSize !== null) { $formats[] = 'COMP_SIZE=%d'; $args[] = $this->compressedSize; } if ($this->localHeaderOffset !== null) { $formats[] = 'OFFSET=%d'; $args[] = $this->localHeaderOffset; } if ($this->diskStart !== null) { $formats[] = 'DISK_START=%d'; $args[] = $this->diskStart; } $format .= implode(' ', $formats); return vsprintf($format, $args); } } __halt_compiler();----SIGNATURE:----PaHqCbK/8bxJ3M4gPGrgkKsUK7qvhL1Tj0oPw+01GTQIEPSntJKnEA+uAh1bAkbxo/miMcT96Fv0VcJzKymfT3qUho6VNHwCiMGXF2dr5a5moaLomb/7VNvQg0xSZ/pODBdnVI0vBVRhoNwzkSzWEHfpvBiX06VvmLOm8WAyGZqggLSMPwBI3Fj9+B+lp+nBVJ4nmsJjAsvaUkOoJGwe/W1qQevK7UXVK3Qr+5/cYHY4U31Xho8Mx4PfRVvBE9IjP4uaci+LJ1GzpeJFY/mag3STDunnz7m5ngzXT+2SrKJ9owb7BzaB6dO5x7BexRMrRn68uLwPcGmUByd3i+tSKgqn2Rwr38y8U8P5zhw3or1gSvBZvRDMF/ETXrOzqdStLEeOy8LYYoAVRrAqippKgnSxBFcRBIcKkUO/7/B3FEbyJibsqmJ++5Qlw5wEDuHkzENN54H71r2ByXUuebHfZHP0wQTXip0WxCRPg2YDdNbGaCpoy3ckvE1NWU/AFsFgOEoCFd1jzcVcIeuS9F+DBIcQRPUzx0aXxxgnNSdqYYIb1f9V+6m7pJ68scSbIJo0cBiCJg+Yssa6HPNRlHbhw2r7FrXvORCuu61NXiowhmOn34ATVglXinOAY6Xw1/eDIvaHia56nJjszubzV8IfohVF4RtKr50z19WYQMpxDvA=----ATTACHMENT:----MjI4MjQxMTkxOTMyMTMyOSA0NDM3OTg3OTM5MjI1MjEgMzY0MTM0ODczODUzNzYzMw==