-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
installed_paths depend on PHP executable? #216
Comments
@kkmuffme This issue is completely unclear to me. This plugin will use the PHP version used during the Composer install to run whatever commands it needs, but the end-result is a |
*seems like this part got somehow removed in my OP, fixed now, this made it unclear |
Cannot reproduce. {
"name": "installes/216",
"require-dev": {
"squizlabs/php_codesniffer": "^3.8.0",
"wp-coding-standards/wpcs": "^3.0.1"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "8.3.0"
}
}
}
|
@kkmuffme Only thing I can think of at this moment is that your custom ruleset contains an |
I have some config directives in the ruleset:
And also some CLI sets:
For whatever reason this issue only occurred for phpcbf but not for phpcs making this even weirder. |
Ah just saw your reproduction - this isn't my case though: in both your cases your "php" executable was the default one (despite being different versions) The issue only happens when EXPLICITLY running it with a different PHP executable |
No, I explicitly run with specific PHP versions, just do so under the hood. Shouldn't make a difference anyhow (and it doesn't).
Seriously, please do some debugging yourself before reporting an issue and report it with a proper reproduction case. |
I can still reproduce this consistently after upgrading phpcs via composer update I have to explicitly run |
@kkmuffme There might be something in your dependencies which is incompatible with PHP 8.0 (used during Also see: #79 Having said that, if that's the case, than:
|
|
No you can't. There must be something else in your
See my previous answer. You can use it like that, but if anything in your dependencies will have installed something which includes syntax incompatible with the runtime PHP version for Composer, the In other words, know your tools. |
Anyway, wish you a great day! |
Problem/Motivation
The loaded rulesets seems to be PHP-executing version specific, while composer itself is not.
My composer.json has
platform.php '8.3.0'
set.My default PHP is 8.0
I install/update normally via
composer install
and see everything is correct:Then I run phpcbf with php 8.3 like: (my-ruleset.xml contains WordPress ruleset)
/usr/bin/php83 /path/to/vendor/bin/phpcbf --standard=/path/to/my-ruleset.xml /other/path/file.php
Expected behaviour
no error
Actual behavior
Error:
Fix
/usr/bin/php83 -d xdebug.mode=off /usr/bin/composer install
I get the same output as above
but then it works correctly.
Proposed changes
The config should be loaded independently of the actually executing PHP script.
This is especially relevant in CI, where 1 PHP version might install packages for various executable PHP versions using
platform.php
.Environment
Tested against
main
branch?main
branch.The text was updated successfully, but these errors were encountered: