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

Request #17813 Prevent PHP notice when extracting corrupted archive
Submitted: 2010-08-25 01:27 UTC
From: doumtidilidoom Assigned: mrook
Status: Closed Package: Archive_Tar (version SVN)
PHP Version: 5.3.3 OS: Windows 7
Roadmaps: 1.3.8    
Subscription  


 [2010-08-25 01:27 UTC] doumtidilidoom (doum-ti-di-li-doom)
Description: ------------ I was extracting a corrupted archive and noticed 2 filesize() calls on a non-existent file I suggest to either test if the file exists and then cache the value Caching could also be done in _openAppend() Is it read immediately and again in the "else" block Purely an optimisation Test script: --------------- // ----- Check the file size clearstatcache(); if (filesize($v_header['filename']) != $v_header['size']) { $this->_error('Extracted file '.$v_header['filename'] .' does not have the correct file size \'' .filesize($v_header['filename']) .'\' ('.$v_header['size'] .' expected). Archive may be corrupted.'); return false; } Expected result: ---------------- // ----- Check the file size clearstatcache(); if (!is_file($v_header['filename'])) { $this->_error('Extracted file '.$v_header['filename'] 'does not exist. Archive may be corrupted.'); return false; } $filesize = filesize($v_header['filename']); if ($filesize != $v_header['size']) { $this->_error('Extracted file '.$v_header['filename'] .' does not have the correct file size \'' .$filesize .'\' ('.$v_header['size'] .' expected). Archive may be corrupted.'); return false; } Actual result: -------------- *

Comments

 [2010-08-25 01:29 UTC] doumtidilidoom (doum-ti-di-li-doom)
Obviously..I meant .' does
 [2010-10-06 00:07 UTC] mrook (Michiel Rook)
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mrook -Roadmap Versions: +Roadmap Versions: 1.3.8
 [2010-10-06 00:36 UTC] mrook (Michiel Rook)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. 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.