From:             chad at getfidelis dot com
Operating system: Linux (Fedora)
PHP version:      5.4.15
Package:          Zip Related
Bug Type:         Bug
Bug description:zip_entry_read never returns FALSE

Description:
------------
---
>From manual page: http://www.php.net/function.zip-entry-read#refsect1-
function.zip-entry-read-returnvalues
---
The function is documented as returning FALSE if the end of the file is
reached.  
However, this never happens: it returns a 0-length string instead.

Observed on CentOS 6.4 and reproducible on:
PHP 5.4.15 (cli) (built: May 22 2013 14:14:09)
PHP 5.3.25 (cli) (built: May 22 2013 14:11:27)

Test script:
---------------
<?php
// Building the zip. This is not expected to work on Windows:
file_put_contents("entry.txt", "abc\nxyz\n");
system("zip -9 file.zip entry.txt");

// With the suitably constructed zip file:
$zh = zip_open('file.zip');
$zeh = zip_read($zh);
zip_entry_open($zh, $zeh);
$ebrake = 8;
while (($part = zip_entry_read($zeh)) !== false && --$ebrake)
  echo "processing part <", trim(preg_replace('/\\s+/', ' ', $part)),
">\n";
?>

Expected result:
----------------
processing part <abc xyz>

Actual result:
--------------
processing part <abc xyz>
processing part <>
processing part <>
processing part <>
processing part <>
processing part <>
processing part <>

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

Reply via email to