Skip to content

Plugin Updater: Avoid false positive on native auto_update_plugins option - #1510

Open
KhushalSainS wants to merge 1 commit into
WordPress:trunkfrom
KhushalSainS:fix/auto-update-plugins-false-positive
Open

KhushalSainS wants to merge 1 commit into
WordPress:trunkfrom
KhushalSainS:fix/auto-update-plugins-false-positive

Conversation

@KhushalSainS

@KhushalSainS KhushalSainS commented Oct 20, 2026 •

Copy link
Copy Markdown

What?

Closes #1506.

Updates Plugin_Updater_Check::look_for_updater_routines() so the auto_update_plugin pattern no longer matches the native auto_update_plugins site option.

Why?

The check used the unanchored regex #auto_update_plugin#, which matches the plural core option name as a substring. A read-only get_site_option( 'auto_update_plugins', array() ) therefore produced update_modification_detected, even though it does not alter update routines or implement a custom updater.

WordPress core itself reads and writes this option in wp_ajax_toggle_auto_updates() and other admin screens, gated by the update_plugins capability.

How?

Adds a trailing word boundary:

-'#auto_update_plugin#'
+'#auto_update_plugin\b#'

This continues to match the singular auto_update_plugin filter while excluding the plural option.

Adds a PHPUnit fixture and regression test for read-only option access. The existing test-plugin-updater-routines-errors fixture continues to assert that add_filter( 'auto_update_plugin', ... ) is still flagged.

Testing Instructions

  1. composer install && npm ci
  2. npm run wp-env:start:tests
  3. Run npm run test-php (full suite).
  4. Manual verification:
    • The new test-plugin-updater-routines-native-option fixture returns Success: Checks complete. No errors found.
    • The existing test-plugin-updater-routines-errors fixture still returns update_modification_detected with Detected: auto_update_plugin.

AI Usage Disclosure

  • This PR was created without the help of AI tools
  • This PR includes AI-assisted code or content

AI tools were used to investigate the check, identify the regex boundary issue, and draft the regression test.
All changes were reviewed and tested .

Open WordPress Playground Preview

The updater routines check used an unanchored auto_update_plugin pattern, which also matched the core auto_update_plugins site option.

Add a trailing word boundary so the auto_update_plugin filter is still detected without flagging the native option. Add a regression test for read-only option access.
@github-actions

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @sensahin.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: sensahin.

Co-authored-by: KhushalSainS <khushalsains@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

False positive: native auto_update_plugins option triggers update_modification_detected

1 participant