Edit report at https://bugs.php.net/bug.php?id=64342&edit=1
ID: 64342 Updated by: a...@php.net Reported by: kolan_n at mail dot ru Summary: ZipArchive::Close returns false on large file trees -Status: Assigned +Status: Closed Type: Bug Package: Zip Related Operating System: Windows PHP Version: 5.4.12 Assigned To: ab Block user comment: N Private report: N New Comment: Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=968ae4a56a08587d73f81f30a0d57fbd109e4cf4 Log: Fixed bug #64342 ZipArchive::addFile() has to check for file existence Previous Comments: ------------------------------------------------------------------------ [2013-03-21 20:00:34] paj...@php.net expand_filepath should do that check, ab, can you check that please? or we can use realpath in this case, which does check everything. ------------------------------------------------------------------------ [2013-03-21 19:29:05] kolan_n at mail dot ru >addFile uses to check file existences https://github.com/php/php-src/blob/master/ext/zip/php_zip.c#L1797 https://github.com/php/php-src/blob/master/ext/zip/php_zip.h#L51 https://github.com/php/php-src/blob/642721b38a9c5ebf336c81027c0dafd6f9246bd6/main/fopen_wrappers.c#L314 It only checks wheither dir exists, but there is no checks for file existence Phar::addFile makes this check, ZipArchive::addFile doesn't. ------------------------------------------------------------------------ [2013-03-21 18:43:41] paj...@php.net Define large files tree. How many entries? No matter the platform, each folder can have a files amount limit, or a limit of file handles per process. It is pretty easy to create to a small script, create a zip objects, add as many files you need to it (from addFromString for example), close it :) About the error code, mind to show a small code to reproduce it? or is it only a file not found on add? addFile uses to check file existences, but only on the method call. If the file disappears between add and close, the close method may file (compression and co is done on close). ------------------------------------------------------------------------ [2013-03-21 18:34:36] kolan_n at mail dot ru I replaced this with PHAR and had found a bug in my script - it tryed to archivate a file which is not present beacuse of some errors in hash calculation (used instead of inode in windows). But the error message should be understandable. It should not be "Unknown error 55703736" it should be "File not found". Also it will be good to add file existence check to ZipArchive::addFile implementation. Now I am using phar but found some bug in its implementation : if there is .gz in the filename (in the middle of it), the archive type is set to tar.gz regardless of the flags. ------------------------------------------------------------------------ [2013-03-21 18:17:57] a...@php.net It's usually not very handy to debug big scripts. It would rock if you could extract a small snippet representing the wrong behavior. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=64342 -- Edit this bug report at https://bugs.php.net/bug.php?id=64342&edit=1