xref: /PHP-7.4/ext/phar/tests/bug70091.phpt (revision 6a0b889f)
1--TEST--
2Bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives)
3--SKIPIF--
4<?php
5if (!extension_loaded('phar')) die('skip phar extension not available');
6if (!extension_loaded('zlib')) die('skip zlib extension not available');
7?>
8--FILE--
9<?php
10$phar = new PharData(__DIR__ . '/bug70091.zip');
11$phar->addFromString('föö', '');
12$phar->addFromString('foo', '');
13unset($phar);
14
15$stream = fopen(__DIR__ . '/bug70091.zip', 'r');
16
17$data = fread($stream, 8);
18var_dump(unpack('H8sig/@6/nflags', $data));
19
20fseek($stream, 53);
21$data = fread($stream, 8);
22var_dump(unpack('H8sig/@6/nflags', $data));
23
24fseek($stream, 104);
25$data = fread($stream, 10);
26var_dump(unpack('H8sig/@8/nflags', $data));
27
28fseek($stream, 173);
29$data = fread($stream, 10);
30var_dump(unpack('H8sig/@8/nflags', $data));
31?>
32--EXPECT--
33array(2) {
34  ["sig"]=>
35  string(8) "504b0304"
36  ["flags"]=>
37  int(8)
38}
39array(2) {
40  ["sig"]=>
41  string(8) "504b0304"
42  ["flags"]=>
43  int(8)
44}
45array(2) {
46  ["sig"]=>
47  string(8) "504b0102"
48  ["flags"]=>
49  int(8)
50}
51array(2) {
52  ["sig"]=>
53  string(8) "504b0102"
54  ["flags"]=>
55  int(8)
56}
57--CLEAN--
58<?php
59@unlink(__DIR__ . '/bug70091.zip');
60?>
61