ID: 46060 Updated by: [EMAIL PROTECTED] -Summary: addEmptyDir() breaks Reported By: xl269 at cam dot ac dot uk -Status: Open +Status: Closed Bug Type: PHAR related Operating System: Debian GNU/Linux lenny PHP Version: 5.3.0alpha2 -Assigned To: +Assigned To: cellog New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. fixed in 5.3, HEAD and pecl, thanks for the report Previous Comments: ------------------------------------------------------------------------ [2008-09-12 16:43:35] xl269 at cam dot ac dot uk the following will create an empty directory "test" $zip->addFromString("test/", ""); ------------------------------------------------------------------------ [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