#46060 [Opn]: addEmptyDir() breaks

From: Date: Fri, 12 Sep 2008 03:49:50 +0000
Subject: #46060 [Opn]: addEmptyDir() breaks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-128897@lists.php.net to get a copy of this message
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: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#128897) next »