[php-src] Issue #11594: in-memory ZipArchive
| From: | rgeraads | Date: | Wed, 05 Jul 2023 07:54:35 +0000 |
| Subject: | [php-src] Issue #11594: in-memory ZipArchive | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244876@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11594
Author: rgeraads
### Description
Currently ZipArchive relies on the filesystem, for both opening and extracting files.
Would it be possible to have it work with files (or data) in memory? Or is that a limitation of the
underlying zip library?
Below is an example of ZipArchive not being able to open files from a virtual file system (probably
because it's a stream).
```
$vfs = \org\bovigo\vfs\vfsStream::setup();
copy('foo.zip', $vfs->url() . '/foo.zip');
var_dump(file_get_contents($vfs->url() . '/foo.zip')); // file contents appears
$zip = new ZipArchive();
$zip->open($vfs->url() . '/foo.zip');
$zip->extractTo(__DIR__); // Uncaught ValueError: Invalid or uninitialized Zip object
$zip->close();
```