Bug #64902 [Asn->Csd]: zip_entry_read never returns FALSE

From: Date: Thu, 16 Apr 2015 13:26:11 +0000
Subject: Bug #64902 [Asn->Csd]: zip_entry_read never returns FALSE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192135@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64902&edit=1

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

 New Comment:

This issue has been fixed in the documentation:

| Returns the data read, empty string on end of a file, or FALSE on
| error.

Thank you for the report, and for helping us make our documentation
better.


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


Thread (3 messages)

« previous php.bugs (#192135) next »