xref: /PHP-8.3/ext/phar/tests/bug79912.phpt (revision 74859783)
1--TEST--
2Bug #79912 (Phar::decompressFiles not working)
3--EXTENSIONS--
4phar
5zlib
6--INI--
7phar.readonly=0
8--FILE--
9<?php
10$phar = new Phar(__DIR__ . "/bug79912.phar");
11$phar->addFromString("test.txt", "This is a test file.This is a test file.This is a test file.");
12$file = $phar["test.txt"];
13var_dump($file->compress(Phar::GZ)); //true (success)
14var_dump($file->getContent());
15var_dump($file->isCompressed()); //true (the file is compressed)
16var_dump($phar->decompressFiles()); //true (success)
17var_dump($file->isCompressed()); //false (the file should not be compressed anymore)
18var_dump($phar->extractTo(__DIR__ . "/bug79912")); //true
19var_dump(file_get_contents(__DIR__ . "/bug79912/test.txt")); //the extracted file in the folder should be decompressed
20?>
21--EXPECT--
22bool(true)
23string(60) "This is a test file.This is a test file.This is a test file."
24bool(true)
25bool(true)
26bool(false)
27bool(true)
28string(60) "This is a test file.This is a test file.This is a test file."
29--CLEAN--
30<?php
31@unlink(__DIR__ . "/bug79912/test.txt");
32@rmdir(__DIR__ . "/bug79912");
33@unlink(__DIR__ . "/bug79912.phar");
34?>
35