Skip to content

Fix option list filtering with autoload and transients#620

Open
ekamran wants to merge 1 commit into
wp-cli:mainfrom
ekamran:fix-option-list-autoload-transients
Open

Fix option list filtering with autoload and transients#620
ekamran wants to merge 1 commit into
wp-cli:mainfrom
ekamran:fix-option-list-autoload-transients

Conversation

@ekamran
Copy link
Copy Markdown

@ekamran ekamran commented Jun 7, 2026

Fixes an issue where wp option list --autoload=on could still include transient rows.

The command already excludes transients by default unless --transients is used. This updates the SQL condition grouping so the autoload and transient filters are applied together correctly.

Tests:

  • composer behat features/option-list.feature:37
  • composer behat features/option-list.feature:4
  • composer behat features/option-list.feature:179
  • composer behat features/option-list.feature:204
  • composer lint
  • composer phpcs
  • composer phpstan
  • git diff --check

@ekamran ekamran requested a review from a team as a code owner June 7, 2026 17:43
@github-actions github-actions Bot added bug command:option Related to 'option' command command:option-list Related to 'option list' command labels Jun 7, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes SQL WHERE clause operator-precedence issues in wp option list so that --autoload=on|off filtering does not inadvertently override transient inclusion/exclusion logic. It aligns the actual results with the command’s documented behavior: transients are excluded by default unless --transients is provided.

Changes:

  • Grouped autoload conditions into a single parenthesized AND ( ... OR ... ) clause to avoid AND/OR precedence bugs.
  • Grouped transient include/exclude conditions into a single parenthesized clause for consistent interaction with other filters.
  • Added a Behat scenario covering --autoload=on behavior with transients (default exclusion vs --transients inclusion).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Option_Command.php Fixes SQL condition grouping so --autoload and transient filters combine correctly.
features/option-list.feature Adds/updates Behat coverage for transient exclusion by default when using --autoload=on.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:option Related to 'option' command command:option-list Related to 'option list' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants