Fix global runtime parameters rejected as "unknown" when used with an alias#228
Closed
Fix global runtime parameters rejected as "unknown" when used with an alias#228
Conversation
2 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Agent-Logs-Url: https://github.com/wp-cli/search-replace-command/sessions/86ae9f44-e5d9-41db-98f4-b3f5b43f15e9 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…unmatched patch Agent-Logs-Url: https://github.com/wp-cli/search-replace-command/sessions/86ae9f44-e5d9-41db-98f4-b3f5b43f15e9 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since WP-CLI v2.13,
Runner::set_alias()incorrectly copies CLI-specified global runtime params (e.g.url,path) into$this->assoc_argswhen an alias defines the same key.Subcommand::validate_args()then rejects them as "unknown" since they are not in the command's local synopsis.Changes
patches/fix-runner-set-alias.php— PatchesRunner::set_alias()in the installed wp-cli/wp-cli vendor to skip global runtime parameter keys (queried fromWP_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 aSTDERRnotice when the target code is not found, indicating the upstream has already fixed this.composer.json— Registerspost-install-cmd/post-update-cmdhooks to apply the patch automatically aftercomposer install/composer update.features/search-replace.feature— Adds a Behat regression test coveringwp @alias --url=... search-replace(with and without--dry-run).phpcs.xml.dist— Excludespatches/from PHPCS; it is build tooling, not plugin code.