Skip to content

Commit

Permalink
fix close container in ZipFile::close()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne-Lexa committed Jan 22, 2020
1 parent 8dcde47 commit 79e77a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ZipFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -1797,8 +1797,9 @@ public function close()
if ($this->reader !== null) {
$this->reader->close();
$this->reader = null;
$this->zipContainer = $this->createZipContainer(null);
}
$this->zipContainer = $this->createZipContainer(null);
gc_collect_cycles();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/Zip64Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PhpZip\Tests;

use PhpZip\Constants\ZipCompressionMethod;
use PhpZip\Exception\ZipException;
use PhpZip\ZipFile;

Expand Down Expand Up @@ -32,7 +33,7 @@ public function testOver65535FilesInZip()

$zipFile = new ZipFile();
for ($i = 0; $i < $countFiles; $i++) {
$zipFile[$i . '.txt'] = (string) $i;
$zipFile->addFromString($i . '.txt', (string) $i, ZipCompressionMethod::STORED);
}
$zipFile->saveAsFile($this->outputFilename);
$zipFile->close();
Expand Down

0 comments on commit 79e77a8

Please sign in to comment.