Lines Matching refs:zip
4 zip
12 $name = __DIR__ . '/encrypted.zip';
16 $zip = new ZipArchive;
17 $r = $zip->open($name, ZIPARCHIVE::CREATE);
19 $zip->addFromString('foo.txt', 'foo');
21 $zip->addFromString('bar.txt', 'bar');
22 var_dump($zip->setEncryptionName('bar.txt', 9999, $pass)); // Fails
23 var_dump($zip->setEncryptionName('bar.txt', ZipArchive::EM_AES_256, $pass));
24 $zip->close();
27 $r = $zip->open($name);
28 $s = $zip->statName('foo.txt');
30 $s = $zip->statName('bar.txt');
32 var_dump($zip->getFromName('foo.txt')); // Clear, ok
33 var_dump($zip->getFromName('bar.txt')); // Encrypted, fails
34 $zip->setPassword($pass);
35 var_dump($zip->getFromName('bar.txt')); // Ecnrypted, ok
36 $zip->close();
39 var_dump(file_get_contents("zip://$name#foo.txt")); // Clear, ok
40 var_dump(file_get_contents("zip://$name#bar.txt")); // Encrypted, fails
41 $ctx = stream_context_create(array('zip' => array('password' => $pass)));
42 var_dump(file_get_contents("zip://$name#bar.txt", false, $ctx)); // Ecnrypted, ok
47 $name = __DIR__ . '/encrypted.zip';