Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.5

Request #14547 Unable to create archive with an empty directory
Submitted: 2008-08-22 19:55 UTC
From: wwalc Assigned:
Status: Open Package: File_Archive (version 1.5.4)
PHP Version: Irrelevant OS: Win XP/SP3
Roadmaps: (Not assigned)    
Subscription  


 [2008-08-22 19:55 UTC] wwalc (Wiktor Walc)
Description: ------------ I need to create empty directories inside of a zip archive. However it seems that it is impossible. I've spent quite a lot of time on trying to resolve it, I'd appreciate if anyone could tell me how to do it... it seems that it is impossible at this moment. Test script: --------------- //create single file in subdirectory works: $targetFile = "test.zip"; require_once "File/Archive.php"; $innerWriter = File_Archive::toFiles(); $dest = File_Archive::toArchive($targetFile, $innerWriter); $dest->newFile("path/to/subdirectory/file.txt"); $dest->writeData("test"); $dest->close(); //but create single empty directory doesn't: $targetFile = "test.zip"; require_once "File/Archive.php"; $innerWriter = File_Archive::toFiles(); $dest = File_Archive::toArchive($targetFile, $innerWriter); $dest->newFile("path/to/subdirectory/"); $dest->close(); Expected result: ---------------- create a test.zip file with an empty directory structure in it Actual result: -------------- empty archive

Comments