|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-09-12 03:33 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 16:00:01 2025 UTC |
the following will create an empty directory "test" $zip->addFromString("test/", "");