Problem/Motivation
During a second composer install, I got this error:
is_dir(): open_basedir restriction in effect.
File(../../doctrine/coding-standard/lib) is not within the allowed path(s):
(/var/www/html:/var/www/.composer:/tmp:/dev/urandom:/proc/self/fd:/usr/local/bin)
This happens, cause during composer install the root directory is not the phpcs directory, therefore the ../../ points out of the projectDir. In my case, the code is limited via open_basedir to the projectDir.
Expected behaviour
No error
Actual behaviour
Code throws error during the second composer install.
Steps to reproduce
Create a project.
composer require --dev \
dealerdirect/phpcodesniffer-composer-installer \
doctrine/coding-standard \
doctrine/doctrine-fixtures-bundle \
squizlabs/php_codesniffer
add an open_basedir restriction in php to the root of the project (e.g. /var/www/html/projectName) where you installed the project.
Do another composer install.
Every composer install after the first one will get an error for open_basedir restriction.
Proposed changes
Change the order of is_readable checks in Plugin.php::cleanInstalledPaths()
See pull request #272
Environment
| Question |
Answer |
| OS |
Linux) |
| PHP version |
8.4.12 |
| Composer version |
2.8.3 |
| PHP_CodeSniffer version |
4.0.1 |
| Install type |
Composer project local |
Tested against main branch?
Problem/Motivation
During a second composer install, I got this error:
This happens, cause during composer install the root directory is not the phpcs directory, therefore the
../../points out of theprojectDir. In my case, the code is limited viaopen_basedirto the projectDir.Expected behaviour
No error
Actual behaviour
Code throws error during the second composer install.
Steps to reproduce
Create a project.
add an
open_basedirrestriction in php to the root of the project (e.g. /var/www/html/projectName) where you installed the project.Do another composer install.
Every composer install after the first one will get an error for
open_basedirrestriction.Proposed changes
Change the order of
is_readablechecks inPlugin.php::cleanInstalledPaths()See pull request #272
Environment
Tested against
mainbranch?mainbranch.