|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66925 encrypt feature
Submitted: 2014-03-18 16:15 UTC Modified: 2018-07-13 17:41 UTC
From: yvs dot ppt at hotmail dot fr Assigned: cmb (profile)
Status: Closed Package: Zip Related
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2014-03-18 16:15 UTC] yvs dot ppt at hotmail dot fr
As "winzip" or "7zip", is-it possible to add encrypt functionnality to ZipArchive ?

may be with:

$zip = new ZipArchive;
$zip->create($zipname, ZipArchive::CREATE);
$zip->setEncryptPassword($secretPhrase); // NEW FEATURE
$zip->addFile($realpath, $localname);

$zip = new ZipArchive;
$zip->create($zipname, ZipArchive::CREATE, $encryptPassword);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-18 16:20 UTC] yvs dot ppt at hotmail dot fr
Sorry, there are no method called create for class ZipArchive.

Creation of zip is done with method open :

$zip->open($zipname, ZipArchive::CREATE);
 [2015-07-17 10:43 UTC]
-Operating System: Windows +Operating System: * -PHP Version: 5.4.26 +PHP Version: *
 [2015-07-17 10:43 UTC]
Actually, this feature wouldn't require a new method, as
ZipArchive::setPassword() could be used, which currently only
works for reading.
 [2015-09-04 22:59 UTC]
-Status: Open +Status: Suspended
 [2015-09-04 22:59 UTC]
I'm suspending this request, until the basic feature is
implemented in libzip.
 [2018-07-13 17:41 UTC]
-Status: Suspended +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-07-13 17:41 UTC]
Encryption of individual files in Zip archives is available as of
PHP 7.2.0 (requires at least libzip 1.2.0)[1].

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