summaryrefslogtreecommitdiff
path: root/ext/zip/tests/bug72374.phpt
blob: b9906c4a9e9722c901cf35789631b67241769c9d (plain)
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
--TEST--
Bug #72374 (ZipArchive::addGlob remove_path option strips first char of filename)
--SKIPIF--
<?php
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
<?php
$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';

$dirname = $dirname . 'bug72374';
mkdir($dirname);
$file1 = $dirname . '/some-foo.txt';
touch($file1);
$file2 = $dirname . '/some-bar.txt';
touch($file2);

$zip = new ZipArchive();
$zip->open($dirname . '/test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->addGlob($file1, 0, array('remove_path' => $dirname . '/some-'));
$zip->addGlob($file1, 0, array('remove_path' => $dirname . '/'));
$zip->addGlob($file2, 0, array('remove_path' => $dirname));
verify_entries($zip, ['foo.txt', 'some-foo.txt', 'some-bar.txt']);
$zip->close();
?>
--CLEAN--
<?php
$dirname = dirname(__FILE__) . '/';
include $dirname . 'utils.inc';

$dirname = $dirname . 'bug72374';
rmdir_rf($dirname);
?>
--EXPECT--