@@ 4530-4537 (lines=8) @@ | ||
4527 | // ----- Go to the end of the zip file |
|
4528 | $v_size = filesize($this->zipname); |
|
4529 | @fseek($this->zip_fd, $v_size); |
|
4530 | if (@ftell($this->zip_fd) != $v_size) |
|
4531 | { |
|
4532 | // ----- Error log |
|
4533 | PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\''); |
|
4534 | ||
4535 | // ----- Return |
|
4536 | return PclZip::errorCode(); |
|
4537 | } |
|
4538 | ||
4539 | // ----- First try : look if this is an archive with no commentaries (most of the time) |
|
4540 | // in this case the end of central dir is at 22 bytes of the file end |
|
@@ 4544-4551 (lines=8) @@ | ||
4541 | $v_found = 0; |
|
4542 | if ($v_size > 26) { |
|
4543 | @fseek($this->zip_fd, $v_size-22); |
|
4544 | if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) |
|
4545 | { |
|
4546 | // ----- Error log |
|
4547 | PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
|
4548 | ||
4549 | // ----- Return |
|
4550 | return PclZip::errorCode(); |
|
4551 | } |
|
4552 | ||
4553 | // ----- Read for bytes |
|
4554 | $v_binary_data = @fread($this->zip_fd, 4); |
|
@@ 4571-4578 (lines=8) @@ | ||
4568 | if ($v_maximum_size > $v_size) |
|
4569 | $v_maximum_size = $v_size; |
|
4570 | @fseek($this->zip_fd, $v_size-$v_maximum_size); |
|
4571 | if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) |
|
4572 | { |
|
4573 | // ----- Error log |
|
4574 | PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\''); |
|
4575 | ||
4576 | // ----- Return |
|
4577 | return PclZip::errorCode(); |
|
4578 | } |
|
4579 | ||
4580 | // ----- Read byte per byte in order to find the signature |
|
4581 | $v_pos = ftell($this->zip_fd); |