php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50797 PHAR fails to extract ZIP archives, but TAR is ok
Submitted: 2010-01-19 07:23 UTC Modified: 2013-02-22 23:34 UTC
Votes:4
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: legolas558 at users dot sourceforge dot net Assigned: ralphschindler (profile)
Status: Closed Package: PHAR related
PHP Version: 5.3.1 OS: Linux 2.6.33-rc4
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: legolas558 at users dot sourceforge dot net
New email:
PHP Version: OS:

 

 [2010-01-19 07:23 UTC] legolas558 at users dot sourceforge dot net
Description:
------------
PHAR extraction of Zip archives is broken

Reproduce code:
---------------
<?php
// phartest.php
try {
    $phar = new PharData($argv[1]);
    $phar->extractTo('/tmp', null, true); // extract all files, and overwrite
} catch (Exception $e) {
        echo $e;
    // handle errors
}
?>


Expected result:
----------------
When running phartest.php with a zip file, it extracts files with no failure but files contain garbage. File size corresponds but content does not. The script works with TAR or TAR.GZ files seamlessly, so I suspect it's due to some library bug. Files in ZIP archive are compressed with normal Deflate method.

Actual result:
--------------
Hexdump of "phartest.php" extracted from a "phartest.zip" archive containing only the phartest.php script.

0000000 8e45 0abd 30c2 8514 f367 6714 b428 4a85
0000010 ae71 8bb6 0eee e26e e210 14d5 1362 6f6e
0000020 447f eefa 1146 d33c be19 b3f3 826d 4a0d
0000030 89f8 4297 1254 66ac d0ec 84d1 b463 2d7b
0000040 4b3a df34 f3c7 92e6 7f57 5d66 2cd3 8dac
0000050 7c9c 9696 08f2 8169 706e 80ae 40f0 8579
0000060 c4b2 808f 0e76 d6b7 5f51 7740 f857 7891
0000070 56e2 2d48 5a30 458c 9876 050d 7d69 8487
0000080 78f2 4565 fac6 bfe8 9f83 1b2a 8e83 cc40
0000090 7b9e a8b5 56a6 0dea 4b50 0201 0314 0314
00000a0 0000 0008 4145 3c33 830d bec4 0098 0000
00000b0 00bc 0000 000c 0000 0000 0000          
00000bc


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-19 07:28 UTC] legolas558 at users dot sourceforge dot net
My Arch linux system is using zlib 1.2.3.4-3 and no other issues with ZIP files
 [2010-06-20 23:57 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cellog
 [2011-10-30 09:01 UTC] mep_eisen at web dot de
Seemed to fall over the same issue. However using file_get_contents and manually extract them will return the correct content. But extractTo does not. Using windows 7 and php 5.3.3.
 [2012-07-03 16:02 UTC] ralphschindler@php.net
Is this still an issue, if so, do you have a phar zip that I can use to reproduce 
this problem?  Or will any zip do?
 [2013-02-22 23:34 UTC] ralphschindler@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


 [2013-02-22 23:34 UTC] ralphschindler@php.net
-Status: Assigned +Status: Closed -Assigned To: cellog +Assigned To: ralphschindler
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC