xref: /PHP-8.0/ext/zip/tests/bug78641.phpt (revision fd3118ff)
1--TEST--
2Bug #78641 (addGlob can modify given remove_path value)
3--SKIPIF--
4<?php
5if (!extension_loaded('zip')) die('skip zip extension not available');
6?>
7--FILE--
8<?php
9define("TMPDIR", __DIR__ . "/");
10
11$file = TMPDIR . 'bug78641';
12touch($file);
13
14$zip = new ZipArchive();
15$zip->open(TMPDIR . "bug78641.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE);
16var_dump(basename(TMPDIR));
17$zip->addGlob($file, 0, ["remove_path" => TMPDIR]);
18var_dump(basename(TMPDIR));
19$zip->close();
20?>
21--EXPECT--
22string(5) "tests"
23string(5) "tests"
24--CLEAN--
25<?php
26unlink(__DIR__ . '/bug78641');
27unlink(__DIR__ . '/bug78641.zip');
28?>
29