FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17330&edit=1

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%

------------------------------------------------------------------------

Search Discussions

  • Onjo at Nov 11, 2011 at 1:07 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=17330&edit=1

    ID: 17330
    Updated by: [email protected]
    Reported By: onjo at acm 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
    Roadmap Versions:
    New Comment:

    My fix is using pack() instead of preg_replace & eval (in
    File/Archive/Writer/Zip.php's getMTime()).
    It is because some specific $mtime bit-pattern break preg_replace and/or
    eval ... sorry, my memory has faded and I don't have environment. :-(


    Previous Comments:
    ------------------------------------------------------------------------

    [2011-11-10 16:49:03] marcj

    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?

    ------------------------------------------------------------------------

    [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%

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 10, '11 at 3:51p
activeNov 11, '11 at 1:07p
posts2
users2
websitepear.php.net

2 users in discussion

Marcj: 1 post Onjo: 1 post

People

Translate

site design / logo © 2023 Grokbase