Lines Matching refs:zip
5 if (!extension_loaded('zip')) die('skip');
11 $name = __DIR__ . '/encrypted.zip';
15 $zip = new ZipArchive;
16 $r = $zip->open($name, ZIPARCHIVE::CREATE);
18 $zip->addFromString('foo.txt', 'foo');
20 $zip->addFromString('bar.txt', 'bar');
21 var_dump($zip->setEncryptionName('bar.txt', 9999, $pass)); // Fails
22 var_dump($zip->setEncryptionName('bar.txt', ZipArchive::EM_AES_256, $pass));
23 $zip->close();
26 $r = $zip->open($name);
27 $s = $zip->statName('foo.txt');
29 $s = $zip->statName('bar.txt');
31 var_dump($zip->getFromName('foo.txt')); // Clear, ok
32 var_dump($zip->getFromName('bar.txt')); // Encrypted, fails
33 $zip->setPassword($pass);
34 var_dump($zip->getFromName('bar.txt')); // Ecnrypted, ok
35 $zip->close();
38 var_dump(file_get_contents("zip://$name#foo.txt")); // Clear, ok
39 var_dump(file_get_contents("zip://$name#bar.txt")); // Encrypted, fails
40 $ctx = stream_context_create(array('zip' => array('password' => $pass)));
41 var_dump(file_get_contents("zip://$name#bar.txt", false, $ctx)); // Ecnrypted, ok
46 $name = __DIR__ . '/encrypted.zip';