php.net |  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
Votes:2
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sombra2eternity at gmail dot com
New email:
PHP Version: OS:

 

 [2014-07-08 12:20 UTC] sombra2eternity at gmail dot com
Description:
------------
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:
---------------
<?php
	$file = '/tmp/data';
	$data = array(1,2,3);
	file_put_contents($file,json_encode($data));
	$r = system('zip -P password file.zip /tmp/data');
	//$r = system('zip file.zip /tmp/data');

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

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

	unlink($file);
	$zip->close();

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

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-08 16:44 UTC] aharvey@php.net
-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] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2015-07-17 10:44 UTC] cmb@php.net
Duplicate of request #66925.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC