ID: 17330
Comment by: marcj
Reported By: marc at kryn dot org
Summary: File_Archive create invalid zip file
Status: Open
Type: Bug
Package: File_Archive
Operating System: Solaris 8
Package Version: 1.5.4
PHP Version: 5.2.10
New Comment:
I can confirm this bug on my machine:
Linux xxx 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64
GNU/Linux
cat /etc/debian_version
5.0.5
php -v
PHP 5.2.6-1+lenny13 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 1 2011
16:01:01)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
The strange thing is, that it works on a other machine with equal
software versions. Can't figure out, where the difference is.
Did you find a solution already? What did you mean with it can be caused
by file's mtime?
Previous Comments:
------------------------------------------------------------------------
[2010-04-21 04:46:20] onjo
Description:
------------
File_Archive create invalid file, it seems to be caused by file's
mtime.
There are no problems on i386 linux + PHP 5.2.13 + File_Archive 1.5.4.
Test script:
---------------
% diff php.ini-dist php.ini
1195a1196
mbstring.internal_encoding = SJIS-WIN
% touch -m -t 201004131354 0413.txt% touch -m -t 201004141354 0414.txt
% cat >test.php
<?
require_once('File/Archive.php');
File_Archive::extract( File_Archive::read("0413.txt"),
File_Archive::toArchive("./0413.zip", File_Archive::toFiles() ));
File_Archive::extract( File_Archive::read("0414.txt"),
File_Archive::toArchive("./0414.zip", File_Archive::toFiles() ));
?>
% php -c php.ini test.php
Expected result:
----------------
% zipinfo 0413.zip
Archive: 0413.zip 116 bytes 1 file
-rw---- 0.0 fat 0 b- defN 13-Apr-10 13:54 0413.txt
1 file, 0 bytes uncompressed, 2 bytes compressed: 0.0%
% zipinfo 0414.zip
Archive: 0414.zip 116 bytes 1 file
-rw---- 0.0 fat 0 b- defN 14-Apr-10 13:54 0414.txt
1 file, 0 bytes uncompressed, 2 bytes compressed: 0.0%
Actual result:
--------------
% zipinfo 0413.zip
Archive: 0413.zip 116 bytes 1 file
-rw---- 0.0 fat 0 b- defN 13-Apr-10 29:36 0413.txt
1 file, 0 bytes uncompressed, 2 bytes compressed: 0.0%
% zipinfo 0414.zip
Archive: 0414.zip 114 bytes 1 file
-rw---- 0.0 fat 134217728 b- defN 28-Jan-80 29:36
note: didn't find end-of-central-dir signature at end of central dir.
1 file, 134217728 bytes uncompressed, 0 bytes compressed: 100.0%
------------------------------------------------------------------------