/php-src/ext/zip/tests/ |
H A D | oo_add_from_string.phpt | 4 zip 14 $file = $dirname . 'tmp.zip'; 17 copy(__DIR__ . '/test.zip', $file); 19 $zip = new ZipArchive(); 20 if (!$zip->open($file)) { 26 var_dump($zip->status == ZipArchive::ER_OK); 32 var_dump($zip->status == ZipArchive::ER_OK); 34 if ($zip->status == ZipArchive::ER_OK) { 35 dump_entries_name($zip); 36 $zip->close(); [all …]
|
H A D | stream_meta_data.phpt | 2 stream_get_meta_data() on zip stream 4 zip 10 $zip = new ZipArchive; 11 if (!$zip->open($file)) { 14 $fp = $zip->getStream('foo'); 21 $zip->close(); 24 $fp = fopen('zip://' . __DIR__ . '/test_with_comment.zip#foo', 'rb'); 42 string(3) "zip" 60 string(11) "zip wrapper" 62 string(3) "zip" [all …]
|
H A D | oo_replacefile.phpt | 4 zip 10 $file = $dirname . 'oo_replacefile.zip'; 12 copy($dirname . 'test.zip', $file); 14 $zip = new ZipArchive; 15 if (!$zip->open($file)) { 18 if ($zip->replaceFile($dirname . 'utils.inc', 5)) { 21 if (!$zip->replaceFile($dirname . 'utils.inc', 0)) { 27 if ($zip->status == ZIPARCHIVE::ER_OK) { 28 if (!verify_entries($zip, [ 38 $zip->close(); [all …]
|
H A D | bug81490.phpt | 4 zip 7 $zip = new ZipArchive(); 8 $zip->open(__DIR__ . "/bug81490.zip", ZipArchive::CREATE|ZipArchive::OVERWRITE); 9 $zip->addFromString("", "yada yada"); 11 $zip->open(__DIR__ . "/bug81490.zip"); 12 $zip->extractTo(__DIR__ . "/bug81490", ""); 17 @unlink(__DIR__ . "/bug81490.zip");
|
H A D | oo_readonly_properties.phpt | 4 zip 8 $zip = new ZipArchive(); 11 $zip->lastId = 1; 17 $zip->lastId += 1; 22 var_dump($zip->lastId); 25 $zip->status = 1; 30 var_dump($zip->status); 33 $zip->statusSys = 1; 41 $zip->numFiles = 1; 57 $zip->comment = "a"; [all …]
|
H A D | oo_addfile_proc.phpt | 4 zip 14 $file = __DIR__ . '/__tmp_oo_addfile_proc.zip'; 16 $zip = new ZipArchive; 17 if (!$zip->open($file, ZIPARCHIVE::CREATE)) { 27 if ($zip->status == ZIPARCHIVE::ER_OK) { 28 dump_entries_name($zip); 29 $zip->close(); 33 var_dump($zip->status); 35 if (!$zip->open($file)) { 38 var_dump(strlen($zip->getFromName('cpu.txt')) > 0); [all …]
|
H A D | oo_close_empty.phpt | 4 zip 11 $name = __DIR__ . '/oo_close_empty.zip'; 14 copy(__DIR__ . '/test.zip', $name); 16 $zip = new ZipArchive(); 17 $zip->open($name, ZIPARCHIVE::CREATE); 20 …var_dump($zip->setArchiveFlag(ZipArchive::AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE, 1), $zip->sta… 24 var_dump($zip->getArchiveFlag(ZipArchive::AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE)); 25 for($i=$zip->numFiles ; $i ;) { 26 $zip->deleteIndex(--$i); 28 $zip->close(); [all …]
|
H A D | oo_count.phpt | 4 zip 9 $file = $dirname . 'test.zip'; 11 $zip = new ZipArchive; 12 if (!$zip->open($file)) { 16 var_dump($zip->numFiles, count($zip), $zip->numFiles == count($zip));
|
H A D | oo_getcomment.phpt | 4 zip 8 $file = $dirname . 'test_with_comment.zip'; 10 $zip = new ZipArchive; 11 if (!$zip->open($file)) { 14 echo $zip->getArchiveComment() . "\n"; 16 $idx = $zip->locateName('foo'); 17 var_dump($zip->getCommentName('foo')); 18 var_dump($zip->getCommentIndex($idx)); 21 echo $zip->getCommentName('') . "\n"; 26 $zip->close();
|
H A D | oo_addemptydir_error.phpt | 4 zip 14 $zip = new ZipArchive; 15 if (!$zip->open(__DIR__ . '/test.zip', ZipArchive::RDONLY)) { 19 var_dump($zip->addEmptyDir('emptydir')); 20 if ($zip->status == ZipArchive::ER_RDONLY) { 22 } else if ($zip->status == ZipArchive::ER_OK) { 23 dump_entries_name($zip); 27 $zip->close();
|
H A D | bug80863.phpt | 4 zip 7 $archive = __DIR__ . "/bug80863.zip"; 9 $zip = new ZipArchive(); 10 $zip->open($archive, ZipArchive::CREATE | ZipArchive::OVERWRITE); 11 $zip->addFromString("file1.txt", "contents"); 12 $zip->addFromString("file2.txt", "contents"); 13 $zip->close(); 25 $zip = new ZipArchive(); 26 $zip->open($archive); 27 $zip->extractTo($target, $files); [all …]
|
H A D | bug_gh12661.phpt | 4 zip 9 touch($file = __DIR__ . '/bug_gh12661.zip'); 11 $zip = new ZipArchive(); 12 $zip->open($file, ZipArchive::CREATE | ZipArchive::OVERWRITE); 13 $zip->addGlob(__FILE__, 0, ['remove_path' => 'bug_']); // unchanged (bug is not a prefix) 14 $zip->addGlob(__FILE__, 0, ['remove_path' => dirname(__DIR__)]); 15 verify_entries($zip, [__FILE__, basename(__DIR__) . DIRECTORY_SEPARATOR . basename(__FILE__)]); 16 $zip->close(); 22 unlink(__DIR__ . '/bug_gh12661.zip');
|
H A D | bug8700.phpt | 4 zip 8 $filename = $thisdir . "/bug8009.zip"; 10 $zip = new ZipArchive(); 12 if ($zip->open($filename) === FALSE) { 15 $contents_from_idx = $zip->getFromIndex(0); 16 $contents_from_name = $zip->getFromName('1.txt'); 22 $zip->close(); 23 echo "status: " . $zip->status . "\n";
|
H A D | bug8009.phpt | 4 zip 8 $src = $thisdir . "/bug8009.zip"; 9 $filename = $thisdir . "/tmp8009.zip"; 12 $zip = new ZipArchive(); 14 if (!$zip->open($filename)) { 17 $zip->addFromString("2.txt", "=)"); 18 $zip->close(); 20 echo "status: " . $zip->status . "\n";
|
H A D | oo_addglob.phpt | 8 zip 17 $file = $dirname . 'tmp.zip'; 20 copy(__DIR__ . '/test.zip', $file); 24 $zip = new ZipArchive(); 25 if (!$zip->open($file)) { 29 if (!$zip->addGlob($dirname . '*.{txt,baz}', GLOB_BRACE, $options)) { 37 var_dump($zip->getStatusString()); 43 if ($zip->status == ZIPARCHIVE::ER_OK) { 44 if (!verify_entries($zip, [ 56 $zip->close(); [all …]
|
H A D | oo_setcomment_error.phpt | 4 zip 7 $file = __DIR__ . '/__tmp_oo_set_comment_error.zip'; 11 $zip = new ZipArchive; 12 if (!$zip->open($file, ZIPARCHIVE::CREATE)) { 16 $zip->addFromString('entry1.txt', 'entry #1'); 17 $zip->addFromString('entry2.txt', 'entry #2'); 22 var_dump($zip->setArchiveComment($longComment)); 27 var_dump($zip->setCommentName('entry1.txt', $longComment)); 32 var_dump($zip->setCommentIndex(1, $longComment)); 37 $zip->close(); [all …]
|
H A D | oo_close.phpt | 2 zip::close() function 4 zip 9 $zip = new ZipArchive; 10 if (!$zip->open($dirname . 'test.zip')) { 14 if ($zip->status == ZIPARCHIVE::ER_OK) { 15 $zip->close();
|
/php-src/ext/phar/tests/zip/ |
H A D | unixzip.phpt | 2 Phar: test a zip archive created by unix "zip" command 7 $a = new PharData(__DIR__ . '/files/zip.zip'); 21 dir phar://%s/zip.zip%cempty 22 phar://%s/zip.zip%chi.txt 25 dir phar://%s/zip.zip%cnotempty 26 phar://%s/zip.zip/notempty%chi.txt
|
H A D | require_hash.phpt | 2 Phar: zip-based phar, require_hash=1, no signature 5 zip 13 $fname = __DIR__ . '/require_hash.phar.zip'; 15 $fname2 = __DIR__ . '/require_hash.zip'; 17 $zip = new zipmaker($fname); 18 $zip->init(); 20 $zip->addFile('internal/file/here', "hi there!\n"); 22 $zip->close(); 45 @unlink(__DIR__ . '/require_hash.phar.zip'); 46 @unlink(__DIR__ . '/require_hash.zip'); [all …]
|
H A D | badalias.phpt | 14 new Phar($e . "badalias$i.phar.zip"); 21 phar error: invalid alias "hi/there" in zip-based phar "%sbadalias1.phar.zip" 22 phar error: invalid alias "hi\there" in zip-based phar "%sbadalias2.phar.zip" 23 phar error: invalid alias "hi\there" in zip-based phar "%sbadalias3.phar.zip" 24 phar error: invalid alias "hi;there" in zip-based phar "%sbadalias4.phar.zip" 25 phar error: invalid alias "hi:there" in zip-based phar "%sbadalias5.phar.zip"
|
H A D | gh10766.phpt | 5 zip 10 $phar = new PharData(__DIR__ . '/gh10766.zip', 0, null, Phar::ZIP); 14 // Re-read from disk, but using the zip extension because the phar bug will not make it possible 16 $zip = new ZipArchive(); 17 $zip->open(__DIR__ . '/gh10766.zip'); 18 var_dump($zip->statName('name')['mtime'] > 315529200 /* earliest possible zip timestamp */); 19 $zip->close(); 23 unlink(__DIR__ . '/gh10766.zip');
|
H A D | corrupt_001.phpt | 2 Phar: corrupted zip (count mismatch) 8 new PharData(__DIR__ . '/files/count1.zip'); 13 new PharData(__DIR__ . '/files/count2.zip'); 19 phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-b… 20 phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-b…
|
/php-src/ext/zip/examples/ |
H A D | set_compression.php | 7 $zip = new ZipArchive(); variable 10 if (!$zip->open($filename, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) { 14 $zip->addFromString("testfilephp.txt", "#1 This is a test string added as testfilephp.txt.\n"); 15 $zip->addFromString("testfilephp2.txt", "#2 This is a test string added as testfilephp2.txt.\n"); 16 $zip->addFile("too.php", "testfromfile.php"); 18 $zip->setCompressionName("testfilephp2.txt", ZipArchive::CM_STORE); 19 $zip->setCompressionIndex(2, ZipArchive::CM_STORE); 21 $zip->close();
|
/php-src/ext/phar/tests/ |
H A D | bug73809.phpt | 5 zip 9 $zip = new ZipArchive; 10 $zip->open(__DIR__ . '/73809.zip', ZipArchive::CREATE); 11 $zip->addFromString('73809.txt', 'yada yada'); 12 $zip->addFromString('.phar/signature.bin', str_repeat('*', 64 * 1024 + 1)); 13 $zip->setCompressionName('.phar/signature.bin', ZipArchive::CM_STORE); 14 var_dump($zip->close()); 17 $phar = new PharData(__DIR__ . '/73809.zip'); 24 @unlink(__DIR__ . '/73809.zip'); 28 phar error: signatures larger than 64 KiB are not supported in zip-based phar "%s"
|
/php-src/ext/zip/ |
H A D | config.w32 | 3 ARG_ENABLE("zip", "ZIP support", "yes,shared"); 6 …if (CHECK_HEADER_ADD_INCLUDE("zip.h", "CFLAGS_ZIP", PHP_PHP_BUILD + "\\include;" + PHP_EXTRA_INCLU… 8 (PHP_ZIP_SHARED && CHECK_LIB("libzip.lib", "zip", PHP_ZIP) || 9 ….lib", "zip", PHP_ZIP) && CHECK_LIB("libbz2_a.lib", "zip", PHP_ZIP) && CHECK_LIB("zlib_a.lib", "zi… 11 EXTENSION('zip', 'php_zip.c zip_stream.c'); 12 ADD_EXTENSION_DEP('zip', 'pcre'); 19 AC_DEFINE('HAVE_ZIP', 1, "Define to 1 if the PHP extension 'zip' is available."); 22 WARNING("zip not enabled; libraries and headers not found");
|