mirror of
https://github.com/php/php-src.git
synced 2026-04-27 18:23:26 +02:00
68f5289e9e
When extracting compressed files from an uncompressed Phar, we must not use the direct file pointer, but rather get an uncompressed file pointer. We also add a test to show that deflated and stored entries are properly extracted. This also fixes #79912, which appears to be a duplicate of #69279. Co-authored-by: Anna Filina <afilina@gmail.com> Closes GH-6599.
27 lines
792 B
PHP
27 lines
792 B
PHP
--TEST--
|
|
Bug #69279 (Compressed ZIP Phar extractTo() creates garbage files)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('phar')) die('skip phar extension not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$phar = new PharData(__DIR__ . '/bug69279a.zip');
|
|
mkdir(__DIR__ . '/bug69279a');
|
|
var_dump($phar->extractTo(__DIR__ . '/bug69279a', null, true));
|
|
var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/1.txt'), 'Lorem ipsum', 11));
|
|
var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/2.txt'), 'foo', 3));
|
|
var_dump(strncmp(file_get_contents(__DIR__ . '/bug69279a/3.txt'), 'Lorem ipsum', 11));
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
int(0)
|
|
int(0)
|
|
int(0)
|
|
--CLEAN--
|
|
<?php
|
|
@unlink(__DIR__ . '/bug69279a/1.txt');
|
|
@unlink(__DIR__ . '/bug69279a/2.txt');
|
|
@unlink(__DIR__ . '/bug69279a/3.txt');
|
|
@rmdir(__DIR__ . '/bug69279a');
|