Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.0

Bug #18895 ->extract() fails without throwing exception; ->listContent() returns int(0)
Submitted: 2011-10-08 23:27 UTC
From: matthewslyman Assigned:
Status: Bogus Package: Archive_Tar (version 1.3.7)
PHP Version: 5.2.12 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2011-10-08 23:27 UTC] matthewslyman (Matthew Slyman)
Description: ------------ http://geolite.maxmind.com/download/geoip/database/GeoLite City.dat.gz There is nothing wrong with the archive from Maxmind - I have no problems extracting the contents of the archive on MS Windows 7 using the free 7Zip software. I'm not getting any PHP errors or warnings with my code. According to 7Zip, the extracted file name is: "GeoLiteCity.dat" Having downloaded this file into a temporary directory (PHP has no problems writing to this directory); I am attempting to use Archive_Tar to extract the file into the same directory (or, into a new subdirectory to be created by the extract() function). Either way, it silently fails without throwing an exception. Test script: --------------- $archive=New Archive_Tar($compressed_file_path,'gz'); $archive->extract(dirname($compressed_file_path)); var_dump($archive->listContent()); Expected result: ---------------- 1. $archive should be created. 2. Compressed files in archive should be extracted to destination directory. (Otherwise, ->extract() should throw an exception.) 3. Output should contain list of file names in Array() from listContent() function. Actual result: -------------- 1. Successfully created the $archive. (NO problem here.) 2. ->extract() silently fails! File is NOT extracted to destination. 3. var_dump() echoes the following output: "int(0)"

Comments

 [2012-02-16 23:45 UTC] mrook (Michiel Rook)
Not entirely sure what you want me to do about this, GeoLiteCity.dat.gz is not a valid TAR archive?
 [2012-04-05 14:21 UTC] mrook (Michiel Rook)
-Status: Open +Status: Feedback
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PEAR.
 [2012-04-05 14:52 UTC] matthewslyman (Matthew Slyman)
Thank you for your attention. Excuse my ignorance of the various UNIX/ LINUX file compression formats. With a little help from StackOverflow.com - I've been able to decompress ".gz" files using the following function: function decompress_gz($src, $dest) { //Should check type and throw exception when not actual .gz file $sfp = gzopen($src, "rb"); $fp = fopen($dest, "w"); while ($string = gzread($sfp, 4096)) {fwrite($fp, $string, strlen($string));} gzclose($sfp); fclose($fp); if(hash_file('md5',$src)===hash_file('md5',$dest) && filesize($src)===filesize($dest)){ throw new Exception('Malfunctioned decompressing ['.basename($src).'] - archive identical to decompressed file!');//Not decompressed! [This could mean file was not .gz archive and therefore .gz decompression failed] }else{ return file_exists($dest); } }
 [2014-05-30 17:56 UTC] mrook (Michiel Rook)
-Status: Feedback +Status: Bogus
Sorry, but your problem does not imply a bug in PEAR itself. For a list of more appropriate places to ask for help using PEAR, please visit http://pear.php.net/support/ as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PEAR. Thanks for the feedback.