PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File Formats » Archive_Tar » Bug #1130

none working bz2

Details

Submitted2004-04-05 00:33 UTC
Fromdavid dot sauer at t-online dot de
Assignedvblavet
StatusClosed
PackageArchive_Tar
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2004-04-05 00:33 UTC] david dot sauer at t-online dot de

Description:
------------
the bz2 compression could not be used.
the gz compression is activated or none.

Reproduce code:
---------------
the Tar.php from line 104 on:
} else {
if (($p_compress == true) || ($p_compress == 'gz')) {
$this->_compress = true;
$this->_compress_type = 'gz';
} else if ($p_compress == 'bz2') {
$this->_compress = true;
$this->_compress_type = 'bz2';
}
}
better:
} else {
if (($p_compress === true) || ($p_compress == 'gz')) {
$this->_compress = true;
$this->_compress_type = 'gz';
} else if ($p_compress == 'bz2') {
$this->_compress = true;
$this->_compress_type = 'bz2';
}
}

Expected result:
----------------
The check $p_compress == true in line 105 will return true
when the $p_compress is a string with the content "bz2".
When the check is changed to $p_compress === true it will
check if the content is boolen and true. That returns
false with the content "bz2".

[2004-04-06 06:38 UTC] vblavet at php dot net

This is corrected in version 1.16 in CVS :
http://cvs.php.net/co.php/pear/Archive_Tar/Archive/Tar.php?r=1.16

[2004-04-06 06:42 UTC] vblavet at php dot net

Also corrected in Package release 1.1

[2004-04-06 08:02 UTC] david dot sauer at t-online dot de

i have not compiled with gz only with bz2.
when i use release 1.1 or 1.16 and do that
"$tar_object = new Archive_Tar("n.tar.bz2", "bz2");"
the messsage is
"The extension 'zlib' couldn't be found. Please make sure
your version of PHP was built with 'zlib' support."
when i change the == to === in line 105 it works.

[2004-04-06 12:15 UTC] vblavet at php dot net

Yes sorry you are right. On line 113, the test must be with '=== true'. Corrected in CVS 1.17.