Make WordPress Core

Changeset 62932


Ignore:
Timestamp:
07/29/2026 08:43:59 PM (4 months ago)
Author:
westonruter
Message:

Plugins: Pass the missing $paged to install_plugins_upload.

The install_plugins_{$tab} action has documented a $paged parameter since 2.7.0, when r8540 introduced the Add Plugins screen. Since r38172 the Add Plugins screen also fires the upload instance of it directly, so that the upload form can be printed on every tab rather than only its own, and that call was left passing no arguments. On the upload tab a callback received $paged; on every other tab the callback received nothing, raising an ArgumentCountError if it declared the parameter.

Also declare $tab and $paged as globals after WP_Plugin_Install_List_Table::prepare_items() populates them, documenting the side effect that the rest of the file has always relied on.

This call site was surfaced by the PHPStan extensions under development for this ticket, which are committed separately.

Developed as subset of ​https://github.com/WordPress/wordpress-develop/pull/12022.
Follow-up to r8540, r37221, r38172.

See #65376.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/plugin-install.php

    r57658 r62932  
    4040
    4141$wp_list_table->prepare_items();
     42
     43/**
     44 * WP_Plugin_Install_List_Table::prepare_items() populates these globals, which
     45 * are used throughout the rest of this file.
     46 *
     47 * @global string $tab   The current tab of the Install Plugins screen.
     48 * @global int    $paged The current page number of the plugins list.
     49 */
     50global $tab, $paged;
    4251
    4352$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
    … …  
    170179                <?php
    171180                /** This action is documented in wp-admin/plugin-install.php */
    172                 do_action( 'install_plugins_upload' );
     181                do_action( 'install_plugins_upload', $paged );
    173182                ?>
    174183        </div>
Note: See TracChangeset for help on using the changeset viewer.