mirror of
https://github.com/Ne-Lexa/php-zip.git
synced 2025-08-06 15:36:28 +02:00
fix bug issue #8 - Error if the file is empty
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace PhpZip;
|
||||
|
||||
use PhpZip\Exception\ZipAuthenticationException;
|
||||
@@ -1811,6 +1812,19 @@ class ZipFileTest extends ZipTestCase
|
||||
self::assertTrue($result);
|
||||
}
|
||||
|
||||
public function testEmptyContents()
|
||||
{
|
||||
$zipFile = new ZipFile();
|
||||
$contents = '';
|
||||
$zipFile->addFromString('file', $contents);
|
||||
$zipFile->saveAsFile($this->outputFilename);
|
||||
$zipFile->close();
|
||||
|
||||
$zipFile->openFile($this->outputFilename);
|
||||
self::assertEquals($zipFile['file'], $contents);
|
||||
$zipFile->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test support ZIP64 ext (slow test - normal).
|
||||
* Create > 65535 files in archive and open and extract to /dev/null.
|
||||
|
Reference in New Issue
Block a user