Doc #54515 [NEW]: Documentation claims that "zip:" wrapper allows writing
| From: | alvaro at demogracia dot com | Date: | Tue, 12 Apr 2011 14:45:10 +0000 |
| Subject: | Doc #54515 [NEW]: Documentation claims that "zip:" wrapper allows writing | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-6226@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Documentation claims that "zip:" wrapper allows writing
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 bug report at http://bugs.php.net/bug.php?id=54515&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54515&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54515&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54515&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54515&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54515&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54515&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54515&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54515&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54515&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54515&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54515&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54515&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54515&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54515&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54515&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54515&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54515&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54515&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54515&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54515&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54515&r=mysqlcfg