Req #67590 [Opn->Dup]: Ziparchive is unable add a file with password

From: Date: Fri, 17 Jul 2015 10:44:17 +0000
Subject: Req #67590 [Opn->Dup]: Ziparchive is unable add a file with password
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194513@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67590&edit=1 ID: 67590 Updated by: cmb@php.net Reported by: sombra2eternity at gmail dot com Summary: Ziparchive is unable add a file with password -Status: Open +Status: Duplicate Type: Feature/Change Request Package: Zip Related Operating System: Ubuntu 14.04 PHP Version: 5.6.0RC2 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Duplicate of request #66925. Previous Comments: ------------------------------------------------------------------------ [2015-04-24 14:32:22] cmb@php.net Related To: Bug #69520 ------------------------------------------------------------------------ [2015-04-16 13:03:09] cmb@php.net Related To: Bug #68036 ------------------------------------------------------------------------ [2014-09-18 00:52:23] miguelwmonteiro at gmail dot com so basically the set password is used to extract and not to encrypt? ------------------------------------------------------------------------ [2014-07-08 12:20:39] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67590&edit=1

« previous php.bugs (#194513) next »