|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63461 Error in example code #2
Submitted: 2012-11-08 00:15 UTC Modified: 2012-11-08 02:21 UTC
From: daniel at mameso dot com Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.4.8 OS: osx
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: daniel at mameso dot com
New email:
PHP Version: OS:


 [2012-11-08 00:15 UTC] daniel at mameso dot com
From manual page:

hi, error in the Example #2 at

is (wrong):

$fp = fopen('zip://' . dirname(__FILE__) . '/', 'r');
if (!$fp) {
    exit("Datei kann nicht geƶffnet werden\n");
while (!feof($fp)) {
    $contents .= fread($fp, 2);
    echo "$contents\n";
echo "Erledigt.\n";

problem part is:

while (!feof($fp)) {
    $contents .= fread($fp, 2);
    echo "$contents\n";

it adds filecontent to $content and output it so:


right is:

while (!feof($fp)) {
    $contents .= fread($fp, 2);
echo "$contents\n";


while (!feof($fp)) {
    $contents = fread($fp, 2);
    echo "$contents";

best regards,

Test script:
see description


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-08 02:21 UTC]
Automatic comment from SVN on behalf of aharvey
Log: Update example 2 of ZipArchive::getStream().

Fixes doc bug #63461 (Error in example code #2).
 [2012-11-08 02:21 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

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

 [2012-11-08 02:21 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: aharvey
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 17 09:03:37 2021 UTC