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