php-zip
php-zip copied to clipboard
Handle directory symlinks properly.
| Q | A |
|---|---|
| Bug fix? | yes |
| New feature? | no |
As symlinks are special files in the zip, symlinks to directories must be treated like files and must loose their directory attribute. Those zip entries may not have / as a suffix in their name, as ZipEntry->setName() would mark them as a directory.
Note that PHP treats symlinks as files, so FilesUtil::removeDir() had to be modified too for the test to pass.
$ php -r 'chdir(exec("mktemp -d")); mkdir("one"); symlink("./one", "symlinked"); rmdir("one"); rmdir("symlinked"); unlink("symlinked");'
Produces: PHP Warning: rmdir(symlinked): Not a directory in Command line code on line 1
But unlink() succeeds.