php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71665 ZipArchive::getStream doesn't take into account setPassword
Submitted: 2016-02-25 18:19 UTC Modified: 2017-11-28 08:44 UTC
From: julientld at free dot fr Assigned: ab (profile)
Status: Closed Package: zip (PECL)
PHP Version: 7.0.3 OS: Windows 7
Private report: No CVE-ID: None
 [2016-02-25 18:19 UTC] julientld at free dot fr
Description:
------------
I try to read directly the content of a ZIP archive entry with ZipArchive::getStream to put its content into a variable with fread().

The archive is protected by a password (ZipCrypto standard method).

But getStream() doesn't take into account setPassword().

I do not have problem to read the entry with getStream() from a non-password protected archive.

I do not have problem to extract the entry with extractTo() from a password protected archive.

Thanks.



Host configuration : Windows 7, IIS, PHP 7.0.3 NTS x64, FastCGI

Test script:
---------------
<?php
$zip = new ZipArchive;
$zip->open("test.zip");
$zip->setPassword("password");
$fileID = $zip->getStream("test.txt");
if(is_resource($fileID))
{
	echo("OK");
}
else
{
	echo("NOT OK");
}
fclose($fileID);
$zip->close();
?>

Expected result:
----------------
OK

Actual result:
--------------
NOT OK

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-22 12:34 UTC] julientld at free dot fr
Any news ?
 [2017-11-28 08:44 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2017-11-28 08:44 UTC] ab@php.net
Fixed in latest versions.

Thanks.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 07:03:33 2021 UTC