From:             
Operating system: Linux
PHP version:      5.2.13
Package:          Zip Related
Bug Type:         Bug
Bug description:CRC32 Error not reported

Description:
------------
I corrupted a file using a hex editor.

"echo shell_exec('unzip -t file')" shows the CRC32 mismatch.



ZipArchive::extractTo() doesn't report CRC32 errors.



Reading a stream received from ZipArchive::getStream('myfile') echoes a CRC
error if the number of bytes read with one fread() is below 2157 bytes.



Test script:
---------------
$zip = new ZipArchive();

if ($zip->open('test.zip')) {

  zip->extractTo('mydir'); //no error printed



  $fp = $z->getStream('brokenfile');

  while (!feof($fp)) {

    $buf .= fread($fp, 2048+108); //CRC error printed

  }

  $fclose($fp);



  $fp = $z->getStream('brokenfile');

  while (!feof($fp)) {

    $buf .= fread($fp, 2048+109); //CRC error NOT printed

  }

  $fclose($fp);



  zip.close()

}

Expected result:
----------------
A CRC32 error report that can be handled.



The one from "fread($fp, 2048+108)" is fine: "Warning: fread()
[function.fread]: Zip stream error: CRC error in ..." (can be handled with
"ob_get_contents()");



For "ZipArchive::extractTo()" the corrupt file(s) should be printed.

Actual result:
--------------
CRC32 errors are reported always.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52091&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52091&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52091&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52091&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52091&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52091&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52091&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52091&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52091&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52091&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52091&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52091&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52091&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52091&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52091&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52091&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52091&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52091&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52091&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52091&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52091&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52091&r=mysqlcfg

Reply via email to