|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67590 Ziparchive is unable add a file with password
Submitted: 2014-07-08 12:20 UTC Modified: 2015-07-17 10:44 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: sombra2eternity at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: Zip Related
PHP Version: 5.6.0RC2 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2014-07-08 12:20 UTC] sombra2eternity at gmail dot com
Ziparchive now is able to read the files inside a password protected zip file, but is yet unable to append new files to this package using the supplied password.

Test script:
	$file = '/tmp/data';
	$data = array(1,2,3);
	$r = system('zip -P password /tmp/data');
	//$r = system('zip /tmp/data');

	$zip = new ZipArchive;
	$r = $zip->setPassword('password');
	$data = $zip->getFromName('tmp/data');

	/* Insert new file */
	$r = $zip->addFromString('tmp/test',json_encode($data));
	$data = $zip->getFromName('tmp/data');


Expected result:
The new file added is encrypted by the password you set.

Actual result:
The file is currently not protected by any password


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-08 16:44 UTC]
-Type: Bug +Type: Feature/Change Request -Package: Zlib related +Package: Zip Related
 [2014-09-18 00:52 UTC] miguelwmonteiro at gmail dot com
so basically the set password is used to extract and not to encrypt?
 [2015-07-17 10:44 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2015-07-17 10:44 UTC]
Duplicate of request #66925.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 01:01:29 2024 UTC