Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-7.1: Fix #70103: ZipArchive::addGlob ignores remove_all_path option news entry for PR #1430
- Loading branch information
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--TEST-- | ||
Bug #70103 (ZipArchive::addGlob ignores remove_all_path option) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('zip')) die('skip zip support not available'); | ||
?> | ||
--FILE-- | ||
<?php | ||
$dir = __DIR__ . '/bug70103'; | ||
|
||
mkdir($dir); chmod($dir, 0777); | ||
file_put_contents($dir . '/foo.txt', 'foo'); | ||
|
||
$zip = new ZipArchive(); | ||
$zip->open($dir . '/test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); | ||
$zip->addGlob($dir . '/*.txt', GLOB_NOSORT, array('remove_all_path' => true)); | ||
$zip->close(); | ||
|
||
$zip = new ZipArchive(); | ||
$zip->open($dir . '/test.zip'); | ||
var_dump($zip->numFiles); | ||
var_dump($zip->getNameIndex(0)); | ||
$zip->close(); | ||
?> | ||
--CLEAN-- | ||
<?php | ||
$dir = __DIR__ . '/bug70103'; | ||
unlink($dir . '/foo.txt'); | ||
unlink($dir . '/test.zip'); | ||
rmdir($dir); | ||
?> | ||
--EXPECT-- | ||
int(1) | ||
string(7) "foo.txt" |