Created
July 15, 2016 02:38
-
-
Save tyage/173cac00c035289bd4b55beada67d55d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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); | |
$file = $dirname . 'some-foo.txt'; | |
touch($file); | |
$zip = new ZipArchive(); | |
$zip->open($dirname . 'test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); | |
$zip->addGlob($file, 0, array('remove_path' => $dirname . 'some-')); | |
$zip->addGlob($file, 0, array('remove_path' => $dirname)); | |
dump_entries_name($zip); | |
$zip->close(); | |
?> | |
--CLEAN-- | |
<?php | |
$dirname = dirname(__FILE__) . '/'; | |
include $dirname . 'utils.inc'; | |
$dirname = $dirname . 'bug72374/'; | |
rmdir_rf($dirname); | |
?> | |
--EXPECTF-- | |
0 foo.txt | |
1 /some-foo.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment