php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58091 compressAllFiles*() fails with Phar
Submitted: 2008-03-08 22:18 UTC Modified: 2008-03-22 18:30 UTC
From: sfox@php.net Assigned:
Status: Not a bug Package: phar (PECL)
PHP Version: 5_2 CVS-2008-03-08 OS: win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sfox@php.net
New email:
PHP Version: OS:

 

 [2008-03-08 22:18 UTC] sfox@php.net
Description:
------------
Although the compression tests phar_bz2.phpt and phar_gzip.phpt both pass, they actually test the PHP version of phar creation/compression and not the C version.

Tar works fine (both Phar and PharData).

NB this is with 5_3, but there's no option for that :)

Reproduce code:
---------------
<?php

$fname = dirname(__FILE__) . '/myphar.phar';
$phar = new Phar($fname);
$phar['index.php'] = '<?php echo "hello world\n"; ?>';
$phar['bulk.txt'] = str_repeat('a', 8000);
$phar->compressAllFilesGZ();
var_dump($phar->isCompressed());

?>


Expected result:
----------------
int(4096)

Actual result:
--------------
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-22 18:30 UTC] greg at chiaraquartet dot net
This results from a serious confusion over what is being compressed.  compressAllFilesGZ() compresses internal files inside a phar, but compresses the whole file for a tar.  isCompressed() only returns 4096 if the whole file is compressed with GZ.

Needless to say, this API must be cleaned up, it is too confusing
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 23:01:28 2024 UTC