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

Bug #14596 data read during tar import includes slashes
Submitted: 2008-09-04 17:01 UTC
From: sharoncorrell Assigned: cbrunet
Status: Closed Package: File_Archive (version 1.5.4)
PHP Version: 5.2.5 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2008-09-04 17:01 UTC] sharoncorrell (Sharon Correll)
Description: ------------ When trying to import a TAR archive, the read routine completely fails. This appears to be caused by the fact that reading the header sections puts them in string format, including \0 to replace null bytes, etc. This changes the byte count of the data so that the unpack function does not find the format it expects. The patch is to include a strip_slashes statement in the File_Archive_Reader_Tar->_nextAdvance() method: $rawHeader = $this->source->getData(512); $rawHeader = strip_slashes($rawHeader);

Comments

 [2008-09-04 17:35 UTC] sharoncorrell (Sharon Correll)
Actually the better patch is to turn off magic quotes while reading the data: $save_magic_quotes = get_magic_quotes_runtime(); set_magic_quotes_runtime(0); $rawHeader = $this->source->getData(512); set_magic_quotes_runtime($save_magic_quotes); if (PEAR::isError($rawHeader)) { return $rawHeader; } // etc.
 [2008-09-09 15:24 UTC] cbrunet (Charles Brunet)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I did the correction on Reader/File.php .