181 public function __set($name, $value)
183 trigger_error(
"Cannot write property $name", E_USER_ERROR);
193 $this->compressed_data =
$data;
194 $this->compressed_size = strlen(
$data);
204 if ($this->compressed_size >= $this->min_compressed_size)
207 if (substr($this->compressed_data, 0, 3) !==
"\x1F\x8B\x08")
213 $this->flags = ord($this->compressed_data[3]);
216 if ($this->flags > 0x1F)
222 $this->position += 4;
225 $mtime = substr($this->compressed_data, $this->position, 4);
227 if (current(unpack(
'S',
"\x00\x01")) === 1)
229 $mtime = strrev($mtime);
231 $this->MTIME = current(unpack(
'l', $mtime));
232 $this->position += 4;
235 $this->XFL = ord($this->compressed_data[$this->position++]);
238 $this->OS = ord($this->compressed_data[$this->position++]);
241 if ($this->flags & 4)
244 $this->SI1 = $this->compressed_data[$this->position++];
245 $this->SI2 = $this->compressed_data[$this->position++];
248 if ($this->SI2 ===
"\x00")
254 $len = current(unpack(
'v', substr($this->compressed_data, $this->position, 2)));
255 $this->position += 2;
258 $this->min_compressed_size += $len + 4;
259 if ($this->compressed_size >= $this->min_compressed_size)
262 $this->extra_field = substr($this->compressed_data, $this->position, $len);
263 $this->position += $len;
272 if ($this->flags & 8)
275 $len = strcspn($this->compressed_data,
"\x00", $this->position);
278 $this->min_compressed_size += $len + 1;
279 if ($this->compressed_size >= $this->min_compressed_size)
282 $this->filename = substr($this->compressed_data, $this->position, $len);
283 $this->position += $len + 1;
292 if ($this->flags & 16)
295 $len = strcspn($this->compressed_data,
"\x00", $this->position);
298 $this->min_compressed_size += $len + 1;
299 if ($this->compressed_size >= $this->min_compressed_size)
302 $this->comment = substr($this->compressed_data, $this->position, $len);
303 $this->position += $len + 1;
312 if ($this->flags & 2)
315 $this->min_compressed_size += $len + 2;
316 if ($this->compressed_size >= $this->min_compressed_size)
319 $crc = current(unpack(
'v', substr($this->compressed_data, $this->position, 2)));
322 if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
324 $this->position += 2;
338 if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) ===
false)
344 $this->position = $this->compressed_size - 8;
348 $crc = current(unpack(
'V', substr($this->compressed_data, $this->position, 4)));
349 $this->position += 4;
356 $isize = current(unpack(
'V', substr($this->compressed_data, $this->position, 4)));
357 $this->position += 4;
358 if (sprintf(
'%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf(
'%u', $isize))