') { throw new Exception("Invalid glob header marker found {$startElement}. location:" . ftell($archiveHandle)); } $instance->originalSize = DupArchiveHeaderU::readStandardHeaderField($archiveHandle, 'OS'); $instance->storedSize = DupArchiveHeaderU::readStandardHeaderField($archiveHandle, 'SS'); $instance->hash = DupArchiveHeaderU::readStandardHeaderField($archiveHandle, 'HA'); // Skip the fread($archiveHandle, 4); if ($skipGlob) { if (fseek($archiveHandle, $instance->storedSize, SEEK_CUR) === -1) { throw new Exception("Can't fseek when skipping glob at location:" . ftell($archiveHandle)); } } return $instance; } /** * Get glob content from header * * @param resource $archiveHandle archive hadler * @param self $header chunk glob header * @param bool $isCompressed true if is compressed * * @return string */ public static function readContent($archiveHandle, self $header, $isCompressed) { if ($header->storedSize == 0) { return 0; } if (($globContents = fread($archiveHandle, $header->storedSize)) === false) { throw new Exception("Error reading glob content"); } return ($isCompressed ? gzinflate($globContents) : $globContents); } }