Skip to content

Prevent file paths from being parsed as tool options - #1234

Merged
veewee merged 1 commit into
phpro:v2.xfrom
veewee:bugfix/option-like-file-paths
Oct 2, 2026
Merged

veewee merged 1 commit into
phpro:v2.xfrom
veewee:bugfix/option-like-file-paths

Conversation

@veewee

@veewee veewee commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

GrumPHP passes repository files as separate arguments to the external tools it runs. A file whose name starts with -, such as --config=other.php, was read by the tool as an option instead of a path. Paths starting with - now get a ./ prefix in ProcessArgumentsCollection, which covers every task that passes files this way. I didn't use a -- separator because not every wrapped tool supports it, and several tasks append options like --fix after the file list.

The git_blacklist task now runs git with --literal-pathspecs, so a file name starting with : is no longer read as pathspec magic, and a file with a leading - no longer makes git grep fail.

The new E2E tests also run on AppVeyor to confirm the prefixed paths resolve on Windows.

Tasks pass repository files as separate arguments to external tools, so a
file named like "--config=x.php" was read as an option. Paths starting with
"-" are now prefixed with "./". A "--" separator is not used because not
every tool supports it and several tasks append options such as "--fix"
after the file list.

git_blacklist now runs with --literal-pathspecs, so a file name starting
with ":" is no longer read as pathspec magic.
@veewee
veewee merged commit 107a8e4 into phpro:v2.x Oct 2, 2026
26 checks passed
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

Successfully merging this pull request may close these issues.

1 participant