php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64902 zip_entry_read never returns FALSE
Submitted: 2013-05-22 18:27 UTC Modified: 2015-04-16 13:26 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: chad at getfidelis dot com Assigned: cmb (profile)
Status: Closed Package: Zip Related
PHP Version: 5.4.15 OS: Linux (Fedora)
Private report: No CVE-ID: None
 [2013-05-22 18:27 UTC] 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 <>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-06 22:05 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: pajoye
 [2015-04-16 13:26 UTC] cmb@php.net
-Status: Assigned +Status: Closed -Assigned To: pajoye +Assigned To: cmb
 [2015-04-16 13:26 UTC] cmb@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC