xref: /PHP-7.0/ext/phar/tests/zip/bzip2.phpt (revision eb41e0d6)
1--TEST--
2Phar: process bzip2-compressed zip entry
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
6<?php if (!extension_loaded("bz2")) die("skip bz2 not available"); ?>
7--FILE--
8<?php
9try {
10	$a = new PharData(dirname(__FILE__) . '/files/bzip2.zip');
11	foreach ($a as $entry => $file) {
12		echo $file->getContent();
13	}
14	$a = new Phar(dirname(__FILE__) . '/files/bz2_alias.phar.zip');
15	var_dump($a->getAlias());
16} catch (Exception $e) {
17	echo $e->getMessage() . "\n";
18}
19?>
20===DONE===
21--EXPECT--
22<?php
23include dirname(__FILE__) . '/corrupt_zipmaker.php.inc';
24$a = new corrupt_zipmaker;
25$a->addFile('hi', null, 'hii');
26$a->addFile('hi2', null, 'hii2', null, null, 'encrypt', 'encrypt');
27$a->writeZip(dirname(__FILE__) . '/encrypted.zip');
28$a = new corrupt_zipmaker;
29$a->addFile('hi', null, 'hii');
30$a->addFile('', null, 'stdin');
31$a->writeZip(dirname(__FILE__) . '/stdin.zip');
32$a = new corrupt_zipmaker;
33$a->addFile('hii', null, 'hii', null, null, 'filename_len', 'filename_len');
34$a->addFile('hi', null, 'hii');
35$a->writeZip(dirname(__FILE__) . '/truncfilename.zip');
36$a = new corrupt_zipmaker;
37$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress');
38$a->writeZip(dirname(__FILE__) . '/compress_unsup1.zip');
39$a = new corrupt_zipmaker;
40$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 2);
41$a->writeZip(dirname(__FILE__) . '/compress_unsup2.zip');
42$a = new corrupt_zipmaker;
43$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 3);
44$a->writeZip(dirname(__FILE__) . '/compress_unsup3.zip');
45$a = new corrupt_zipmaker;
46$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 4);
47$a->writeZip(dirname(__FILE__) . '/compress_unsup4.zip');
48$a = new corrupt_zipmaker;
49$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 5);
50$a->writeZip(dirname(__FILE__) . '/compress_unsup5.zip');
51$a = new corrupt_zipmaker;
52$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 6);
53$a->writeZip(dirname(__FILE__) . '/compress_unsup6.zip');
54$a = new corrupt_zipmaker;
55$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 7);
56$a->writeZip(dirname(__FILE__) . '/compress_unsup7.zip');
57$a = new corrupt_zipmaker;
58$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 9);
59$a->writeZip(dirname(__FILE__) . '/compress_unsup9.zip');
60$a = new corrupt_zipmaker;
61$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 10);
62$a->writeZip(dirname(__FILE__) . '/compress_unsup10.zip');
63$a = new corrupt_zipmaker;
64$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 14);
65$a->writeZip(dirname(__FILE__) . '/compress_unsup14.zip');
66$a = new corrupt_zipmaker;
67$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 18);
68$a->writeZip(dirname(__FILE__) . '/compress_unsup18.zip');
69$a = new corrupt_zipmaker;
70$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 19);
71$a->writeZip(dirname(__FILE__) . '/compress_unsup19.zip');
72$a = new corrupt_zipmaker;
73$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 97);
74$a->writeZip(dirname(__FILE__) . '/compress_unsup97.zip');
75$a = new corrupt_zipmaker;
76$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 98);
77$a->writeZip(dirname(__FILE__) . '/compress_unsup98.zip');
78$a = new corrupt_zipmaker;
79$a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 11);
80$a->writeZip(dirname(__FILE__) . '/compress_unsupunknown.zip');
81?>
82string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip"
83===DONE===
84