Edit report at https://bugs.php.net/bug.php?id=64902&edit=1

 ID:                 64902
 Updated by:         fel...@php.net
 Reported by:        chad at getfidelis dot com
 Summary:            zip_entry_read never returns FALSE
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            Zip Related
 Operating System:   Linux (Fedora)
 PHP Version:        5.4.15
-Assigned To:        
+Assigned To:        pajoye
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2013-05-22 18:27:08] chad at getfidelis dot com

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 this bug report at https://bugs.php.net/bug.php?id=64902&edit=1

Reply via email to