Req #80372 [Opn]: Allow ZipArchive to open archive from string or at least data URL
Edit report at https://bugs.php.net/bug.php?id=80372&edit=1
ID: 80372
Updated by: cmb@php.net
Reported by: michael dot vorisek at email dot cz
Summary: Allow ZipArchive to open archive from string or at
least data URL
Status: Open
Type: Feature/Change Request
Package: Zip Related
PHP Version: 7.4.12
Block user comment: N
Private report: N
New Comment:
Well, we're somewhat limited by libzip here. Besides zip_open()
what we're already using to open from a path, there is only
zip_fdopen() which would allow opening from a file descriptor. So
for most protocol wrappers we would need to create a temporary
file, what can be done in userland as well.
> This is important as on RO filesystems zip archives can not be
> currently opened and files like Excel can no be read.
Not even if you pass ZipArchive::OPEN_RDONLY as $flag to ::open()?
Previous Comments:
------------------------------------------------------------------------
[2020-11-15 21:08:08] michael dot vorisek at email dot cz
Description:
------------
ZipArchive does currently not allow to open archive from string not data URL.
This is a feature request to allow ZipArchive to open archive from string or at least data URL.
This is important as on RO filesystems zip archives can not be currently opened and files like Excel
can no be read.
Test script:
---------------
$dataAsUrl = $imageData = 'data:application/octet-stream;base64,' .
base64_encode($fileData);
$zip = new \ZipArchive();
$zip->open($dataAsUrl);
Expected result:
----------------
ZipArchive object can open/load data from string or from data URL.
Actual result:
--------------
<b>Warning</b>: ZipArchive::open(): File name is longer than the maximum allowed path
length on this platform (4096): data:application/octet-stream;base64,UEsDBBQABgAIAAA
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80372&edit=1
Thread (3 messages)