Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle directory symlinks properly. #75

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

parhuzamos
Copy link

@parhuzamos parhuzamos commented Jan 12, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant