xref: /PHP-7.4/ext/phar/tests/bug76584.phpt (revision 136f51f1)
1--TEST--
2Bug #76584 (PharFileInfo::decompress not working)
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$phar = new Phar(__DIR__ . '/76584.phar');
13$phar->addFromString('76584.txt', 'This is a test file.');
14$file = $phar['76584.txt'];
15var_dump($file->compress(Phar::GZ));
16var_dump($file->isCompressed());
17var_dump($file->decompress());
18var_dump($file->isCompressed());
19mkdir(__DIR__ . '/76584');
20var_dump($phar->extractTo(__DIR__ . '/76584'));
21echo file_get_contents(__DIR__ . '/76584/76584.txt');
22?>
23--EXPECT--
24bool(true)
25bool(true)
26bool(true)
27bool(false)
28bool(true)
29This is a test file.
30--CLEAN--
31<?php
32unlink(__DIR__ . '/76584/76584.txt');
33rmdir(__DIR__ . '/76584');
34unlink(__DIR__ . '/76584.phar');
35?>
36