xref: /PHP-8.1/ext/zip/tests/oo_add_encoding.phpt (revision 74859783)
1--TEST--
2ziparchive::addEmptyDir with encoding option
3--EXTENSIONS--
4zip
5--SKIPIF--
6<?php
7/* $Id$ */
8?>
9--FILE--
10<?php
11
12include __DIR__ . '/utils.inc';
13$dirname = __DIR__ . '/oo_add_encoding_dir/';
14$file = $dirname . 'tmp.zip';
15
16@mkdir($dirname);
17$zip = new ZipArchive;
18if (!$zip->open($file, ZipArchive::CREATE)) {
19    exit('failed');
20}
21
22$zip->addEmptyDir('foo');
23$zip->addEmptyDir(chr(0x82), ZipArchive::FL_ENC_CP437);
24$zip->addEmptyDir('è', ZipArchive::FL_ENC_UTF_8);
25
26$zip->addFromString('bar', __FILE__);
27$zip->addFromString(chr(0x91), __FILE__, ZipArchive::FL_ENC_CP437);
28$zip->addFromString('€', __FILE__, ZipArchive::FL_ENC_UTF_8);
29
30if ($zip->status == ZIPARCHIVE::ER_OK) {
31    dump_entries_name($zip);
32    $zip->close();
33} else {
34    echo "failed\n";
35}
36?>
37--CLEAN--
38<?php
39$dirname = __DIR__ . '/oo_add_encoding_dir/';
40unlink($dirname . 'tmp.zip');
41rmdir($dirname);
42?>
43--EXPECT--
440 foo/
451 é/
462 è/
473 bar
484 æ
495 €
50