Skip to content
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

phpcs-diff fails if the path to PHP_BINARY contains a space character #12

Open
richaber opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@richaber
Copy link

If there is a space character in the path to the PHP_BINARY, phpcs-diff will fail.
Presumably other unescaped but valid path characters would have the same effect.

Path to the PHP_BINARY in my environment (macOS)...

'/Users/user_name/Library/Application Support/Local/lightning-services/php-8.0.30+0/bin/darwin-arm64/bin/php'

The phpcs-diff failure looks like this...

$ ./vendor/bin/phpcs-diff master
sh: /Users/user_name/Library/Application: No such file or directory
Unable to run phpcs executable.

I am able to resolve this for my environment by using escapeshellarg on PHP_BINARY at line 220 of \PhpcsDiff\PhpcsDiff::runPhpcs() like so...

$exec = escapeshellarg( PHP_BINARY ) . ' ' . $exec;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant