Skip to content

in-memory ZipArchive #11594

Open
Open
@rgeraads

Description

@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();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions