Skip to content

Fix global runtime parameters rejected as "unknown" when used with an alias#228

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-global-runtime-parameters
Closed

Fix global runtime parameters rejected as "unknown" when used with an alias#228
Copilot wants to merge 3 commits intomainfrom
copilot/fix-global-runtime-parameters

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

Since WP-CLI v2.13, Runner::set_alias() incorrectly copies CLI-specified global runtime params (e.g. url, path) into $this->assoc_args when an alias defines the same key. Subcommand::validate_args() then rejects them as "unknown" since they are not in the command's local synopsis.

# Fails — alias present alongside --url:
wp @dev --url=https://example.com search-replace 'example.com' 'example.test'
# Error: Parameter errors:
#  unknown --url parameter

Changes

  • patches/fix-runner-set-alias.php — Patches Runner::set_alias() in the installed wp-cli/wp-cli vendor to skip global runtime parameter keys (queried from WP_CLI::get_configurator()->get_spec()) when deciding what to copy into $this->assoc_args. Keys are cached in a static variable. The script is idempotent (via an embedded marker) and emits a STDERR notice when the target code is not found, indicating the upstream has already fixed this.

  • composer.json — Registers post-install-cmd / post-update-cmd hooks to apply the patch automatically after composer install / composer update.

  • features/search-replace.feature — Adds a Behat regression test covering wp @alias --url=... search-replace (with and without --dry-run).

  • phpcs.xml.dist — Excludes patches/ from PHPCS; it is build tooling, not plugin code.

The patch is a temporary shim. It should be removed once the fix lands in wp-cli/wp-cli upstream.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI changed the title [WIP] Fix global runtime parameters rejected as "unknown" when used with an alias Fix global runtime parameters rejected as "unknown" when used with an alias Apr 11, 2026
Copilot AI requested a review from swissspidy April 11, 2026 16:29
@swissspidy swissspidy closed this Apr 11, 2026
@swissspidy swissspidy deleted the copilot/fix-global-runtime-parameters branch April 11, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:search-replace Related to 'search-replace' command scope:testing Related to testing state:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global runtime parameters rejected as "unknown" when used with an alias

2 participants