xref: /PHP-8.0/ext/phar/tests/bug69279a.phpt (revision edb38973)
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--FILE--
9<?php
10$phar = new PharData(__DIR__ . '/bug69279a.zip');
11mkdir(__DIR__ . '/bug69279a');
12var_dump($phar->extractTo(__DIR__ . '/bug69279a', null, true));
13var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/1.txt'), 'Lorem ipsum', 11));
14var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/2.txt'), 'foo', 3));
15var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/3.txt'), 'Lorem ipsum', 11));
16?>
17--EXPECT--
18bool(true)
19int(0)
20int(0)
21int(0)
22--CLEAN--
23<?php
24@unlink(__DIR__ . '/bug69279a/1.txt');
25@unlink(__DIR__ . '/bug69279a/2.txt');
26@unlink(__DIR__ . '/bug69279a/3.txt');
27@rmdir(__DIR__ . '/bug69279a');
28