mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Merge branch 'PHP-7.1'
* PHP-7.1: Fix #70103: ZipArchive::addGlob ignores remove_all_path option news entry for PR #1430
This commit is contained in:
commit
1db0569514
3
NEWS
3
NEWS
@ -103,4 +103,7 @@ PHP NEWS
|
||||
- XMLRPC:
|
||||
. Use Zend MM for allocation in bundled libxmlrpc (Joe)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb)
|
||||
|
||||
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
|
||||
|
@ -1704,8 +1704,8 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
|
||||
entry_name = entry_name_buf;
|
||||
entry_name_len = strlen(entry_name);
|
||||
} else {
|
||||
entry_name = Z_STRVAL_P(zval_file);
|
||||
entry_name_len = Z_STRLEN_P(zval_file);
|
||||
entry_name = file_stripped;
|
||||
entry_name_len = file_stripped_len;
|
||||
}
|
||||
if (basename) {
|
||||
zend_string_release(basename);
|
||||
|
34
ext/zip/tests/bug70103.phpt
Normal file
34
ext/zip/tests/bug70103.phpt
Normal file
@ -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"
|
Loading…
Reference in New Issue
Block a user