Doc #54515 [Opn->Csd]: Documentation claims that "zip:" wrapper allows writing
| From: | frozenfire@php.net | Date: | Sat, 02 Jul 2011 06:53:26 +0000 |
| Subject: | Doc #54515 [Opn->Csd]: Documentation claims that "zip:" wrapper allows writing | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-6801@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54515&edit=1
ID: 54515
Updated by: frozenfire@php.net
Reported by: alvaro at demogracia dot com
Summary: Documentation claims that "zip:" wrapper allows
writing
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: frozenfire
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:
------------------------------------------------------------------------
[2011-04-12 16:45:09] alvaro at demogracia dot com
Description:
------------
The "Wrapper Summary" table states that all three wrappers allow writing. That does not
seem to be the case for "zip:". My test code fails when trying to write and docs for
ZipArchive::getStream() <http://es2.php.net/ziparchive-getstream>
clearly state that the returned file handler "only supports read operations".
---
From manual page: http://www.php.net/wrappers.compression#Options
---
Test script:
---------------
<?php
// Create test archive
$zip = new ZipArchive;
$res = $zip->open('./foo.zip', ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addFromString('bar.txt', 'Lorem ipsum dolor sit amet.');
$zip->close();
} else {
die('Could not create ZIP archive');
}
// Read through fopen() wrapper
$fp = fopen('zip://./foo.zip#bar.txt', 'r');
if( $fp ){
while( !feof($fp) ){
echo fread($fp, 8192);
}
fclose($fp);
}
// Write through fopen() wrapper
$fp = fopen('zip://./foo.zip#bar.txt', 'w');
if( $fp ){
fwrite($fp, 'Consectetur adipisicing elit.');
fclose($fp);
}
?>
Expected result:
----------------
Lorem ipsum dolor sit amet.
Actual result:
--------------
Warning: fopen(zip://./foo.zip#bar.txt) [http://es.php.net/function.fopen]: failed to open stream:
operation failed in C:\tmp\test.php on line 23
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54515&edit=1