Skip to content

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

@richaber

Description

@richaber

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions