xref: /PHP-8.0/ext/phar/tests/bug69279.phpt (revision 4c1b3e30)
1--TEST--
2Bug #69279 (Compressed ZIP Phar extractTo() creates garbage files)
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--INI--
9phar.readonly=0
10--FILE--
11<?php
12$w = new Phar(__DIR__ . "/bug69279.phar.zip");
13$w["bug69279.txt"] = "Sample content.";
14$w->compressFiles(Phar::GZ);
15unset($w);
16
17$r = new Phar(__DIR__ . "/bug69279.phar.zip");
18var_dump($r["bug69279.txt"]->isCompressed());
19
20$r->extractTo(__DIR__, NULL, TRUE);
21var_dump(file_get_contents(__DIR__ . "/bug69279.txt"));
22?>
23--EXPECT--
24bool(true)
25string(15) "Sample content."
26--CLEAN--
27<?php
28@unlink(__DIR__ . "/bug69279.txt");
29@unlink(__DIR__ . "/bug69279.phar.zip");
30?>
31