ID: 46060 User updated by: xl269 at cam dot ac dot uk Reported By: xl269 at cam dot ac dot uk Status: Open Bug Type: PHAR related Operating System: Debian GNU/Linux lenny PHP Version: 5.3.0alpha2 New Comment:
the following will create an empty directory "test" $zip->addFromString("test/", ""); Previous Comments: ------------------------------------------------------------------------ [2008-09-12 03:49:50] xl269 at cam dot ac dot uk whoops, the "* result" sections should read "test.tar" not "test.tar.bz2" (if it isn't obvious). i was playing around with the bug whilst editing this report, and overlooked updating that part. ------------------------------------------------------------------------ [2008-09-12 03:33:30] xl269 at cam dot ac dot uk Description: ------------ PharData::addEmptyDir() on a tar archive adds empty files instead of directories. Reproduce code: --------------- $zip = new PharData('test.tar'); $zip = $zip->convertToData(Phar::TAR, Phar::NONE); // compression scheme does not affect the result. // Phar::ZIP is not buggy, but you need to add a file to the empty directory to see this. $zip->startBuffering(); $zip->addEmptyDir('test/'); // $zip->addFile('file', 'test/file'); // see (*) $zip->stopBuffering(); Expected result: ---------------- test.tar.bz2 should contain 1 empty directory "test" Actual result: -------------- test.tar.bz2 contains 1 empty *file* "test" (*) doing this will create the directory "test" automatically, so that the tar archive now contains both a file and a directory called "test", and becomes unextractable. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46060&edit=1