|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44201 Creating zip files cant use : in filename
Submitted: 2008-02-21 10:33 UTC Modified: 2008-11-02 13:30 UTC
From: liamwheldon at gmail dot com Assigned: pajoye (profile)
Status: Not a bug Package: Zip Related
PHP Version: 5.2.5 OS: 2003 Server & XP
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: liamwheldon at gmail dot com
New email:
PHP Version: OS:


 [2008-02-21 10:33 UTC] liamwheldon at gmail dot com
I recently came across an issue when creating zip file son the fly where windows XP built in zip archive viewer show'd no files within the archive yet Winrar show'd the files fine. I have found the issue to be in the time stamp as there is a ':' between hour and minute, once removed this works fine in XP zip archive viewer.

Reproduce code:
  $zip = new ZipArchive();
  $filename = 'E:/liam/bksbvalidation/';
  if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
    exit("cannot open <$filename>\n");
  $zip->addFile('E:/Liam/keyskillbuilder/trials/bksb Initial Assessment/Results/HTML/5bf57268_liam wheldon_1.html', 'Initial assessment result 20th Feb 2008 9:37.html');

Expected result:
I would expect to receive and open a readable zip archive

Actual result:
The zip archive wont open in windows XP zip archive viewer yet all 3rd party zip readers work, yet show the file as not being HTML.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-21 23:21 UTC]
Sounds like a bug in the windows zip tool.As you said it works with pkzip, winzip, winrar, infozip, magiczip, etc.

I would suggest to either encode (see the shell escaping/encoding function in php) the column or don't use it. I can't force an encoding, it will break OS specific encoding.

I'll check again the specs to see how to act with these characters.

By the way, you don't need the unlink(..), you can force the creation of a new archive with the open method.
 [2008-11-02 13:30 UTC]
Not a PHP bug.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 12:01:23 2020 UTC