Closed
Description
Hi!
Within this loop: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Config.php#L349-L360
do {
foreach ($defaultFiles as $defaultFilename) {
$default = $currentDir.DIRECTORY_SEPARATOR.$defaultFilename;
if (is_file($default) === true) {
$this->standards = [$default];
break(2);
}
}
$lastDir = $currentDir;
$currentDir = dirname($currentDir);
} while ($currentDir !== '.' && $currentDir !== $lastDir);
... The $default
file becomes:
$default = /home/tria2wxw20z4/public_html/wp-admin/.phpcs.xml
$default = /home/tria2wxw20z4/public_html/wp-admin/phpcs.xml
$default = /home/tria2wxw20z4/public_html/wp-admin/.phpcs.xml.dist
$default = /home/tria2wxw20z4/public_html/wp-admin/phpcs.xml.dist
$default = /home/tria2wxw20z4/public_html/.phpcs.xml
$default = /home/tria2wxw20z4/public_html/phpcs.xml
$default = /home/tria2wxw20z4/public_html/.phpcs.xml.dist
$default = /home/tria2wxw20z4/public_html/phpcs.xml.dist
$default = /home/tria2wxw20z4/.phpcs.xml
$default = /home/tria2wxw20z4/phpcs.xml
$default = /home/tria2wxw20z4/.phpcs.xml.dist
$default = /home/tria2wxw20z4/phpcs.xml.dist
$default = /home/.phpcs.xml
Once the files go outside of the user's home directory, they trigger the following warning:
Warning: is_file(): open_basedir restriction in effect. File(/home/.phpcs.xml) is not within the allowed path(s):
In my particular instance, the warning is corrupting the ajax response of this WordPress plugin: https://github.com/WPTRT/theme-sniffer