1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 21:41:22 +02:00
Files
archived-php-src/ext/zip/tests/bug78641.phpt
Christoph M. Becker fd3118ffb0 Fix #78641: addGlob can modify given remove_path value
`remove_path` points to the given string, so we must not modify it.
Instead we use a duplicate, if we need the modification.

We may want to switch to `zend_string`s in master.
2019-10-08 09:45:05 +02:00

29 lines
613 B
PHP

--TEST--
Bug #78641 (addGlob can modify given remove_path value)
--SKIPIF--
<?php
if (!extension_loaded('zip')) die('skip zip extension not available');
?>
--FILE--
<?php
define("TMPDIR", __DIR__ . "/");
$file = TMPDIR . 'bug78641';
touch($file);
$zip = new ZipArchive();
$zip->open(TMPDIR . "bug78641.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE);
var_dump(basename(TMPDIR));
$zip->addGlob($file, 0, ["remove_path" => TMPDIR]);
var_dump(basename(TMPDIR));
$zip->close();
?>
--EXPECT--
string(5) "tests"
string(5) "tests"
--CLEAN--
<?php
unlink(__DIR__ . '/bug78641');
unlink(__DIR__ . '/bug78641.zip');
?>