|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77978 Dirname ending in colon unzips to wrong dir
Submitted: 2019-05-07 08:08 UTC Modified: 2019-10-13 11:08 UTC
From: lars at larsegon dot se Assigned:
Status: Open Package: Zip Related
PHP Version: 7.3.5 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-05-07 08:08 UTC] lars at larsegon dot se
If a directory name in a path for a file in zip archive ends with a colon (:) the file will be extracted to the root dir instead of to its original directory.

Test script:

$file = tempnam("/tmp", "ziptest");
$target = tempnam("/tmp", "ziptest");

$zip = new ZipArchive;
$zip->addFromString("dir/test:/filename.txt", "contents");
$zip->addFromString("dir/test:a/filename.txt", "contents");
$zip->addFromString("dir/test/filename.txt", "contents");

$zip->extractTo($target, "dir/test:/filename.txt");
$zip->extractTo($target, "dir/test:a/filename.txt");
$zip->extractTo($target, "dir/test/filename.txt");


Expected result:
Expected behavior would be that the three files were extracted to the following paths:

Actual result:
If you run the test script, three files will be extracted to the following paths:


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-21 20:01 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: santiagolizardo
 [2019-05-25 01:34 UTC] konstantin dot kuklin at gmail dot com
The following pull request has been associated:

Patch Name: Fixed bug #77978
On GitHub:
 [2019-10-13 11:08 UTC]
-Status: Assigned +Status: Open -Assigned To: santiagolizardo +Assigned To:
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 23:01:27 2019 UTC