forked from pierrejoye/php_zip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug80863.phpt
More file actions
43 lines (39 loc) · 923 Bytes
/
bug80863.phpt
File metadata and controls
43 lines (39 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--TEST--
Bug #80863 (ZipArchive::extractTo() ignores references)
--SKIPIF--
<?php
if (!extension_loaded('zip')) die("skip zip extension not available");
?>
--FILE--
<?php
$archive = __DIR__ . "/bug80863.zip";
$zip = new ZipArchive();
$zip->open($archive, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->addFromString("file1.txt", "contents");
$zip->addFromString("file2.txt", "contents");
$zip->close();
$target = __DIR__ . "/bug80683";
mkdir($target);
$files = [
"file1.txt",
"file2.txt",
];
// turn into references
foreach ($files as &$file);
$zip = new ZipArchive();
$zip->open($archive);
$zip->extractTo($target, $files);
var_dump(is_file("$target/file1.txt"));
var_dump(is_file("$target/file2.txt"));
?>
--EXPECT--
bool(true)
bool(true)
--CLEAN--
<?php
@unlink(__DIR__ . "/bug80863.zip");
$target = __DIR__ . "/bug80683";
@unlink("$target/file1.txt");
@unlink("$target/file2.txt");
@rmdir($target);
?>