Open gizahNL opened 5 years ago
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 Link
s 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()
)?
The problem with ls not returning
Link
s sounds like a bug to me. Which adapter do you use? Eio or child process (justvar_dump
the adapter if you useFilesystem::create()
)?
Indeed, a symlink should show up as a Link
not a File
. What OS/PHP version/adapter/and extensions are you on @gizahNL ?
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()