php-language-server: Error when it cannot read a directory (permission denied)
UnexpectedValueException: RecursiveDirectoryIterator::construct(...): failed to open dir: Permission denied in .../felixfbecker.php-intellisense-1.5.0/vendor/webmozart/glob/src/Iterator/RecursiveDirectoryIterator.php:43
It seems it prevents the plugin from working
If you need more information feel free to ask, I have no idea what to do
note: this folder is in the files.exclude
config of vscode and in the .gitignore
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 11
- Comments: 24 (3 by maintainers)
Is it really hard to add
is_readable
before break everything ? Ortry/catch
on last resort if “not my problem but in lib that I use” 3 years…Any updates on this? I’m still encountering this issue in version v2.3.14
I have the same issue, only my stack trace is somewhat boring:
The folder it is trying to read is a docker mysql data directory. Permissions are set by docker when launched. When manually updating permissions on this directory to be owned by me, the plugin works as expected. This is a bit annoying due to the permissions being overwritten.
As workaround for me is to make the files world readable:
sudo chmod -R o+rx path/to/unreadable/files
This works at least for database files which get mounted into an docker container, assuming being on mac or linux.
In addition, it’d be great to be able to exclude paths to avoid unnecessarily looking in
node_modules
directory, for example.EDIT: That’s https://github.com/felixfbecker/php-language-server/issues/159 and https://github.com/felixfbecker/php-language-server/issues/164
Seems to need fork this, and all related packages to fix and/or improve. Package creator is down many times ago.
Just ran into this while I was developing plugins for Shopware 6 as their development setup makes use of Docker volume mount to a filesystem folder for the MySQL database (example:
dev-ops/docker/_volumes/mysql/shopware_e2e
). As with most volume mounts, it will default to only being accessible by root or whatever use the application inside the Docker container is running as.Since most of my company’s projects are now developed in Docker this is increasingly becoming a showstopper for using this extension.
The fix for this is
php-language-server-master/src/FilesFinder/FileSystemFilesFinder.php
php-language-server-master/src/FilesFinder/GlobIterator.php
Just to add, this is still an issue, and quite serious IMO, as unless you can force everything (first, not necessarily possible, second why should you even) into readable the tool is in essence is unusable. I even tried looking at code hoping it might be some simple flag, but seems it might even be issue in libraries used…
Use the
CATCH_GET_CHILD
flag inRecursiveIteratorIterator
instanciation ? i.e. :See https://stackoverflow.com/a/4550051
Same. In my case it’s the data directory for my PostgreSQL Docker. Unreadable files and directories should be ignored.
Same Issue here, but I assume a different cause. Looks like the String passed to
RecursiveDirectoryIterator::construct()
contains the directory twice, sepaprated by comma. This leads to a nonexisting path.