Doc #63461 [Opn->Csd]: Error in example code #2
| From: | aharvey@php.net | Date: | Thu, 08 Nov 2012 02:21:28 +0000 |
| Subject: | Doc #63461 [Opn->Csd]: Error in example code #2 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9074@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63461&edit=1
ID: 63461
Updated by: aharvey@php.net
Reported by: daniel at mameso dot com
Summary: Error in example code #2
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: osx
PHP Version: 5.4.8
-Assigned To:
+Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2012-11-08 02:21:24] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=328279
Log: Update example 2 of ZipArchive::getStream().
Fixes doc bug #63461 (Error in example code #2).
------------------------------------------------------------------------
[2012-11-08 00:15:17] daniel at mameso dot com
Description:
------------
---
From manual page: http://www.php.net/function.ziparchive-getstream
---
hi, error in the Example #2 at http://de2.php.net/manual/de/function.ziparchive-
getstream.php
is (wrong):
<?php
$fp = fopen('zip://' . dirname(__FILE__) . '/test.zip#test', 'r');
if (!$fp) {
exit("Datei kann nicht geöffnet werden\n");
}
while (!feof($fp)) {
$contents .= fread($fp, 2);
echo "$contents\n";
}
fclose($fp);
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:
aa
aabb
aabbcc
aabbccdd
right is:
while (!feof($fp)) {
$contents .= fread($fp, 2);
}
echo "$contents\n";
OR
while (!feof($fp)) {
$contents = fread($fp, 2);
echo "$contents";
}
best regards,
daniel
Test script:
---------------
see description
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63461&edit=1