php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69520 zipArchive::setPassword
Submitted: 2015-04-24 07:48 UTC Modified: 2015-04-24 14:32 UTC
From: iamchoigo at mkinternet dot com Assigned: cmb (profile)
Status: Not a bug Package: Zip Related
PHP Version: 5.6.8 OS: window
Private report: No CVE-ID: None
 [2015-04-24 07:48 UTC] iamchoigo at mkinternet dot com
Description:
------------
i want to make zip with password. 
But i think zipArchive::setPassword don't work.
When using setPassword that making protected zip. right?
so, i want to reply mail about that. thank.

Test script:
---------------
$zip = new ZipArchive ();
$file = "1.txt"; 
$zipPath = 'test.zip';
if (($zip->open ( $zipPath, ZipArchive::CREATE)) == true) {
	
	$z = $zip->addFile ( $file );
	if($z !== false){
		//var_dump($z);
	}
	$a = $zip->setPassword('abc');
	$zip->close ();
	echo "okey";

Expected result:
----------------
Created ZIP archive should have a password protection, and when opening it on a local machine with WinZIP, the program should ask for the password prior to open the archive.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-24 14:32 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Package: zip +Package: Zip Related -Assigned To: +Assigned To: cmb
 [2015-04-24 14:32 UTC] cmb@php.net
According to the documentation[1] this is not a bug:

| This function only sets the password to be used to decompress the
| archive; it does not turn a non-password-protected ZipArchive
| into a password-protected ZipArchive.

Extending the current behavior has already been filed as request
#67590.

[1] <http://php.net/manual/en/ziparchive.setpassword.php>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC