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

file()->stat() not working as expected when file is symlink #68

Open
gizahNL opened this issue May 2, 2019 · 2 comments
Open

file()->stat() not working as expected when file is symlink #68

gizahNL opened this issue May 2, 2019 · 2 comments

Comments

@gizahNL
Copy link

gizahNL commented May 2, 2019

I'm using dir()->ls() to create an array of nodes which I then stat, unfortunately stat() does not work as expected on symlinks: it returns the size of the symlink file (and not the target), and does not hint it is a symlink.
Neither does the nodelist ls() generates hint any of the files are symlinks: when I echo the class they are all File class.

multiple different solutions exist:
-ls() returns different nodes for files and links

-the file node has an isLink method, returning true or false

-hide the fact that the file is a symlink completely and return properties of target

-return an islink value (with target) when doing stat()

@ghost
Copy link

ghost commented May 4, 2019

stat calls lstat internally, which does not resolve symlink. That's working as intended as we should be able to stat symlinks and not only files.

The problem with ls not returning Links sounds like a bug to me. Which adapter do you use? Eio or child process (just var_dump the adapter if you use Filesystem::create())?

@WyriHaximus
Copy link
Member

The problem with ls not returning Links sounds like a bug to me. Which adapter do you use? Eio or child process (just var_dump the adapter if you use Filesystem::create())?

Indeed, a symlink should show up as a Link not a File. What OS/PHP version/adapter/and extensions are you on @gizahNL ?

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

No branches or pull requests

2 participants