|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72374 ZipArchive::addGlob remove_path option strips first char of filename
Submitted: 2016-06-10 07:57 UTC Modified: 2019-10-02 13:37 UTC
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: namatyage at gmail dot com Assigned: cmb (profile)
Status: Closed Package: zip (PECL)
PHP Version: 7.0Git-2016-06-10 (Git) OS: OS X
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: namatyage at gmail dot com
New email:
PHP Version: OS:


 [2016-06-10 07:57 UTC] namatyage at gmail dot com
After adding a file by addGlob using add_path and remove_path options, the first character of the filename is stripped in the archive.

Test script:
$file = 'foo-bar';

$zip = new ZipArchive();
$zip->open('', ZipArchive::CREATE | ZipArchive::OVERWRITE);
$options = array('add_path' => 'prefix-', 'remove_path' => 'foo-');
$zip->addGlob($file, 0, $options);

for($i = 0; $i < $zip->numFiles; $i++) {
	$sb = $zip->statIndex($i);
	echo $sb['name'];


Expected result:

Actual result:


ziparchive-remove-path-length-option.patch (last revision 2016-06-10 07:57 UTC by namatyage at gmail dot com)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-28 16:06 UTC]
-Status: Open +Status: Verified
 [2016-06-28 16:06 UTC]
I can confirm the issue on Windows (tested PHP 5.4.19, 5.6.15 and
 [2019-10-02 13:34 UTC]
Automatic comment on behalf of
Log: Fix #72374: remove_path strips first char of filename
 [2019-10-02 13:34 UTC]
-Status: Verified +Status: Closed
 [2019-10-02 13:37 UTC]
-Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 20:01:29 2024 UTC