Make WordPress Core

Opened 7 days ago

Last modified 38 hours ago

#65812 accepted defect (bug)

Unreachable "All selected plugins are up to date." admin notice in plugins.php

Reported by: aminurislam01 Owned by: aminurislam01
Priority: normal Milestone: Awaiting Review
Component: Administration Version:
Severity: normal Keywords: good-first-bug has-patch
Cc: Focuses: administration, coding-standards

Description

The admin notice "All selected plugins are up to date." on the Plugins screen is unreachable - it can never be displayed.

In wp-admin/plugins.php the message lives in the results-notice chain:

} elseif ( 'update-selected' === $action ) {
    wp_admin_notice( __( 'All selected plugins are up to date.' ), $updated_notice_args );
}

However, $action is assigned once (from WP_Plugins_List_Table::current_action()) and is never reassigned. Whenever $action === 'update-selected', the earlier switch ( $action ) block enters case 'update-selected':, which renders the bulk-update iframe and ends in an unconditional exit;. Execution therefore never reaches the notice chain with $action === 'update-selected', so the elseif is always false. (PHPStan reports the comparison as "will always evaluate to false.")

How to confirm
No user action can produce the notice. Selecting the bulk "Update" action always renders the iframe update screen (update.php?action=update-selected) and exits; there is no path back to the plugins list that shows this message. The string "All selected plugins are up to date." exists nowhere else in wp-admin.

History (why it is dead)
The branch was introduced together with bulk plugin updates in #11542(2010-01-26) and was reachable then: the handler filtered the selection to out-of-date plugins and did break (not exit) when all were current, falling through to the notice (originally worded "No out of date plugins were selected.").

The iframe rewrite in #11232 (2010-03-06) removed that filtering and the break, making case 'update-selected' end in an unconditional exit;, but left the notice branch behind. It has been unreachable ever since (~15 years), surviving a re-word (2015), the ===== sweep (2020), and the wp_admin_notice() conversion.

Proposed fix
Remove the dead elseif ( 'update-selected' === $action ) branch, since the iframe update screen already reports the "up to date" outcome.

Attachments (2)

65812.diff (719 bytes ) - added by aminurislam01 7 days ago.
Patch: remove dead "All selected plugins are up to date." branch
65812.2.diff (1.7 KB ) - added by aminurislam01 38 hours ago.
Refreshed patch: dead-branch removal + PHPStan baseline update (matches PR 12859 on GitHub).

Download all attachments as: .zip

Change History (8)

@aminurislam01
7 days ago

Patch: remove dead "All selected plugins are up to date." branch

This ticket was mentioned in PR #12859 on WordPress/wordpress-develop by @aminurislam01.


7 days ago
#1

## Summary

Removes an unreachable admin-notice branch on the Plugins screen (wp-admin/plugins.php). The elseif ( 'update-selected' === $action ) branch that prints _"All selected plugins are up to date."_ can never execute.

## Why it is unreachable

  • $action is assigned once, from WP_Plugins_List_Table::current_action(), and is never reassigned.
  • When $action === 'update-selected', the earlier switch ( $action ) enters case 'update-selected':, which renders the bulk-update iframe and ends in an unconditional exit;.
  • Execution therefore never reaches the notice chain while $action === 'update-selected', so the elseif is always false. PHPStan reports the comparison as _"will always evaluate to false."_

The string "All selected plugins are up to date." exists nowhere else in wp-admin, and the iframe update screen (update.php?action=update-selected) already reports the up-to-date outcome.

## History

The branch was reachable when introduced in [11542] (2010): the handler filtered the selection to out-of-date plugins and breaked (not exit) when all were current, falling through to the notice. The iframe rewrite in [11232] removed that filtering and the break, leaving the notice behind. It has been dead code ever since.

## Testing

  • On the Plugins screen, no user action produces the notice; bulk Update always renders the iframe screen.
  • php -l passes; no functional change (removed code was never reached).

#2 @aminurislam01
7 days ago

  • Component GeneralAdministration
  • Owner set to aminurislam01
  • Status newaccepted

Syed-Ateeb-Raza commented on PR #12859:


2 days ago
#3

Hey, the PHPStan failure is just a baseline update needed since the dead code got removed. Running npm run typecheck:php:baselines and committing the updated baseline should sort it out. Happy to test once that's done!

#4 @ateebraza
2 days ago

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/12859

Environment

  • OS: Windows
  • PHP: 7.4
  • WordPress: trunk
  • Browser: Chrome
  • Theme: Twenty Twenty-One
  • Active Plugins: Hello Dolly

Steps Taken

  1. Opened the Plugins screen in the PR Playground instance.
  2. Selected Hello Dolly via the bulk action checkbox.
  3. Picked "Update" from Bulk Actions and hit Apply.

Actual Results

  • Plugins page loads fine, no errors or warnings.
  • Bulk Update runs cleanly.
  • No regressions noticed. Removing the dead code does not break anything.

Additional Notes

PHPStan CI is failing because the baseline needs updating after the dead code got removed. Running npm run typecheck:php:baselines should sort it out. Functionally everything looks good though.

@aminurislam01 commented on PR #12859:


38 hours ago
#5

Hey, the PHPStan failure is just a baseline update needed since the dead code got removed. Running npm run typecheck:php:baselines and committing the updated baseline should sort it out. Happy to test once that's done!

Thanks for testing and for the pointer, @Syed-Ateeb-Raza!

Baseline updated in 88e5d8e — removing the dead branch also removed the identical.alwaysFalse error it produced, so the stale entry in tests/phpstan/baselines/identical.alwaysFalse.neon no longer matched and PHPStan failed with a non-ignorable ignore.unmatched error. I dropped that entry and verified both vendor/bin/phpstan and npm run typecheck:php (Docker) now report no errors.

CI is green across the board now, including the static analysis job. The one remaining red job (Upgrade from 7.1-RC2 / PHP 7.4 with MySQL 5.7 multisite) is unrelated — the MySQL service container failed during setup (Access denied for user 'root'@'localhost') before any WordPress code ran; the same combo passes on PHP 8.4 and the non-multisite variant.

@aminurislam01
38 hours ago

Refreshed patch: dead-branch removal + PHPStan baseline update (matches PR 12859 on GitHub).

#6 @aminurislam01
38 hours ago

The patch has been refreshed following feedback on PR 12859: https://github.com/WordPress/wordpress-develop/pull/12859.

Removing the dead branch also removed the PHPStan identical.alwaysFalse error it produced, so the stale baseline entry in tests/phpstan/baselines/identical.alwaysFalse.neon no longer matched and the static analysis job failed with a non-ignorable ignore.unmatched error. 65812.2.diff adds the baseline update alongside the original dead-branch removal, matching the current state of the PR.

CI on the PR is now fully green, including the static analysis job. The only red job (Upgrade from 7.1-RC2 / PHP 7.4 with MySQL 5.7 multisite) is an unrelated MySQL service-container setup failure — the same combination passes on PHP 8.4 and in the non-multisite variant.

Thanks @ateebraza for the test report.

Note: See TracTickets for help on using tickets.