File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -12,10 +12,6 @@ cache:
1212 - vendor
1313 - $HOME/.composer/cache
1414
15- addons :
16- code_climate :
17- repo_token : 486a09d58d663450146c53c81c6c64938bcf3bb0b7c8ddebdc125fe97c18213a
18-
1915install :
2016 - travis_retry composer self-update && composer --version
2117 - travis_retry composer install --prefer-dist --no-interaction
@@ -25,8 +21,4 @@ before_script:
2521
2622script :
2723 - composer validate --no-check-lock
28- - vendor/bin/phpunit -v -c bootstrap.xml --coverage-clover build/logs/clover.xml
29-
30- after_success :
31- - vendor/bin/test-reporter
32-
24+ - vendor/bin/phpunit -v -c bootstrap.xml
Original file line number Diff line number Diff line change 1+ ## 3.0.3 (2017-11-11)
2+ Fix bug issue #8 - Error if the file is empty.
3+
14## 3.0.0 (2017-03-15)
25Merge ` ZipOutputFile ` with ZipFile and optimize the zip archive update.
36
Original file line number Diff line number Diff line change 66[ ![ Latest Stable Version] ( https://poser.pugx.org/nelexa/zip/v/stable )] ( https://packagist.org/packages/nelexa/zip )
77[ ![ Total Downloads] ( https://poser.pugx.org/nelexa/zip/downloads )] ( https://packagist.org/packages/nelexa/zip )
88[ ![ Minimum PHP Version] ( http://img.shields.io/badge/php%2064bit-%3E%3D%205.5-8892BF.svg )] ( https://php.net/ )
9- [ ![ Test Coverage] ( https://codeclimate.com/github/Ne-Lexa/php-zip/badges/coverage.svg )] ( https://codeclimate.com/github/Ne-Lexa/php-zip/coverage )
109[ ![ License] ( https://poser.pugx.org/nelexa/zip/license )] ( https://packagist.org/packages/nelexa/zip )
1110
1211Table of contents
Original file line number Diff line number Diff line change @@ -151,7 +151,10 @@ public function getEntryContent()
151151 fseek ($ this ->inputStream , $ pos );
152152
153153 // Get raw entry content
154- $ content = fread ($ this ->inputStream , $ this ->getCompressedSize ());
154+ $ content = '' ;
155+ if ($ this ->getCompressedSize () > 0 ) {
156+ $ content = fread ($ this ->inputStream , $ this ->getCompressedSize ());
157+ }
155158
156159 // Strong Encryption Specification - WinZip AES
157160 if ($ this ->isEncrypted ()) {
Original file line number Diff line number Diff line change 11<?php
2+
23namespace PhpZip ;
34
45use PhpZip \Exception \ZipAuthenticationException ;
@@ -1811,6 +1812,19 @@ public function testZipAlign()
18111812 self ::assertTrue ($ result );
18121813 }
18131814
1815+ public function testEmptyContents ()
1816+ {
1817+ $ zipFile = new ZipFile ();
1818+ $ contents = '' ;
1819+ $ zipFile ->addFromString ('file ' , $ contents );
1820+ $ zipFile ->saveAsFile ($ this ->outputFilename );
1821+ $ zipFile ->close ();
1822+
1823+ $ zipFile ->openFile ($ this ->outputFilename );
1824+ self ::assertEquals ($ zipFile ['file ' ], $ contents );
1825+ $ zipFile ->close ();
1826+ }
1827+
18141828 /**
18151829 * Test support ZIP64 ext (slow test - normal).
18161830 * Create > 65535 files in archive and open and extract to /dev/null.
You can’t perform that action at this time.
0 commit comments