|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77214 ZipArchive::extractTo() errors on directories ending with .
Submitted: 2018-11-28 16:21 UTC Modified: 2018-11-28 19:19 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: nystrom dot lars dot egon at gmail dot com Assigned:
Status: Verified Package: Zip Related
PHP Version: 7.2.12 OS: Linux
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: nystrom dot lars dot egon at gmail dot com
New email:
PHP Version: OS:


 [2018-11-28 16:21 UTC] nystrom dot lars dot egon at gmail dot com
This is closely related to bug #69477, but I'm experiencing a different behavior.

When you have a zip archive that contains a directory with a name that ends with . (a dot) ZipArchive errors out with the message:

ZipArchive::extractTo(/path/to/extract/to/): failed to open stream: Is a directory

Test script:
$extractPath = "/path/to/extract/to";
$zip = new ZipArchive;
// Next line causes the error if the zip file contains a directory named 'myfolder.'
$zip->extractTo($extractPath, ['myfolder.']); 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-28 19:19 UTC]
-Status: Open +Status: Verified
 [2018-11-28 19:19 UTC]
I get this error message if the archive contains an *empty*
directory entry with a trailing dot.  Test script:


    $zip = new ZipArchive;
    $zip->open(__DIR__ . '/', ZipArchive::CREATE | ZipArchive::OVERWRITE);

    $zip->open(__DIR__ . '/');
    $zip->extractTo(__DIR__ . '/77214');

The culprit is php_zip_make_relative_path()[1], which mistakenly
returns an empty string instead of "foo."

[1] <>
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 09:01:25 2020 UTC