Bug #67590 [NEW]: Ziparchive is unable add a file with password

From: Date: Tue, 08 Jul 2014 12:20:39 +0000
Subject: Bug #67590 [NEW]: Ziparchive is unable add a file with password
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186528@lists.php.net to get a copy of this message
From: sombra2eternity at gmail dot com Operating system: Ubuntu 14.04 PHP version: 5.6.0RC2 Package: Zlib related Bug Type: Bug Bug description:Ziparchive is unable add a file with password 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 bug report at https://bugs.php.net/bug.php?id=67590&edit=1 --

« previous php.bugs (#186528) next »