xref: /PHP-8.3/ext/phar/tests/bug52013.phpt (revision 74859783)
1--TEST--
2Test for bug 52013 about Phar::decompressFiles().
3--DESCRIPTION--
4Test for a bug where Phar::decompressFiles() mistakenly throws BadMethodCallException.
5http://bugs.php.net/bug.php?id=52013
6--CREDITS--
7Frederic Hardy frederic.hardy@mageekbox.net
8--EXTENSIONS--
9phar
10zlib
11--INI--
12phar.require_hash=0
13phar.readonly=0
14open_basedir=
15--FILE--
16<?php
17mkdir(__DIR__ . '/testdir');
18file_put_contents(__DIR__ . '/testdir/1.php', str_repeat(' ', 1455));
19
20$phar = new Phar(__DIR__ . '/compressed.phar');
21$phar->buildFromDirectory(__DIR__ . '/testdir', '/\.php$/');
22$phar->setSignatureAlgorithm(Phar::SHA1);
23$phar->compressFiles(Phar::GZ);
24$phar->decompressFiles();
25
26echo 'ok';
27?>
28--CLEAN--
29<?php
30if (is_file(__DIR__ . '/testdir/1.php'))
31  unlink(__DIR__ . '/testdir/1.php');
32if (is_dir(__DIR__ . '/testdir'))
33  rmdir(__DIR__ . '/testdir');
34if (is_file(__DIR__ . '/compressed.phar'))
35  unlink(__DIR__ . '/compressed.phar');
36?>
37--EXPECT--
38ok
39