|  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
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 = '';
if (($zip->open ( $zipPath, ZipArchive::CREATE)) == true) {
	$z = $zip->addFile ( $file );
	if($z !== false){
	$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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-24 14:32 UTC]
-Status: Open +Status: Not a bug -Package: zip +Package: Zip Related -Assigned To: +Assigned To: cmb
 [2015-04-24 14:32 UTC]
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

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 23:01:29 2024 UTC