You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If no --standard=... is provided on the command-line, PHPCS will automatically try to find a ruleset with any of the following names: .phpcs.xml, phpcs.xml, .phpcs.xml.dist, phpcs.xml.dist in the current working directory and if it doesn't find one in the current directory, it will traverse up the directory tree trying to find a ruleset file in one of the higher level directories.
If such a ruleset file found in a higher level directory then includes another ruleset file, like a phpcs.xml file using <rule ref="phpcs.xml.dist"/> and "ERROR: Referenced sniff "phpcs.xml.dist" does not exist." will display.
Any included path found in a ruleset should always be evaluated in relation to the ruleset, but I suspect this rule is broken when path traversal has been used to find a ruleset in a higher level directory.
To reproduce
Create a directory for the test setup with the following directory structure:
Describe the bug
If no
--standard=...
is provided on the command-line, PHPCS will automatically try to find a ruleset with any of the following names:.phpcs.xml
,phpcs.xml
,.phpcs.xml.dist
,phpcs.xml.dist
in the current working directory and if it doesn't find one in the current directory, it will traverse up the directory tree trying to find a ruleset file in one of the higher level directories.If such a ruleset file found in a higher level directory then includes another ruleset file, like a
phpcs.xml
file using<rule ref="phpcs.xml.dist"/>
and "ERROR: Referenced sniff "phpcs.xml.dist" does not exist." will display.Any included path found in a ruleset should always be evaluated in relation to the ruleset, but I suspect this rule is broken when path traversal has been used to find a ruleset in a higher level directory.
To reproduce
phpcs.xml.dist
:phpcs.xml
:subdir/test.php
:toplevel/subdir
directory.Expected behavior
No error, i.e. for PHPCS to find the
phpcs.xml.dist
ruleset, include and read it and then execute the scan.Versions (please complete the following information)
master
Please confirm
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: