php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62779 ZipArchive::addFile does not work properly with windows directory separators.
Submitted: 2012-08-08 13:10 UTC Modified: 2013-06-20 10:01 UTC
From: max dot calabrese at nordinteractive dot se Assigned:
Status: Not a bug Package: zip (PECL)
PHP Version: 5.4.5 OS: Windows Server 2008 R2 Web Serve
Private report: No CVE-ID: None
 [2012-08-08 13:10 UTC] max dot calabrese at nordinteractive dot se
Description:
------------
ZipArchive::addFile does not work as expected when using windows directory 
separators (/).

Backslashes in string $filename are not converted into folders.





Test script:
---------------
$zip = new ZipArchive();

if ($zip->open() === true) {

	// gives a file named "dir/somefile.txt"
	$zip->addFile("dir".DIRECTORY_SEPARATOR."somefile.txt");

	// works properly
	$zip->addFile("dir/somefile.txt");
}

$zip->close();


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-20 10:01 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2013-06-20 10:01 UTC] ab@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jun 03 17:01:25 2020 UTC