Opened 5 years ago
Last modified 5 years ago
#52405 new defect (bug)
activate_{$plugin} not passing $network_wide boolean to action handler
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | 3.0 |
| Component: | Plugins | Keywords: | has-patch needs-testing |
| Focuses: | administration, multisite | Cc: |
Description
When using register_activation_hook, the "activate_{$plugin}" action doesn't pass the $network_wide boolean as the parameter for the callback.
Instead, the parameter gets substituted with an empty string, breaking the page when using strict typing, as it expects a boolean.
Looking at how it's done when activating plugins, it uses is_network_admin() as the parameter
https://core.trac.wordpress.org/browser/trunk/src/wp-admin/plugins.php?rev=49683#L124
Same thing should happen here:
https://core.trac.wordpress.org/browser/trunk/src/wp-admin/plugins.php?rev=49683#L193
do_action( "activate_{$plugin}", is_network_admin() );
Change History (4)
Note: See
TracTickets for help on using
tickets.
When using
register_activation_hook, the"activate_{$plugin}"action doesn't pass the$network_wideboolean as the parameter for the callback.Instead, the parameter gets substituted with an empty string, breaking the page when using strict typing, as it expects a boolean.
Looking at how it's done when activating plugins, it uses
is_network_admin()as the parameterhttps://github.com/WordPress/wordpress-develop/blob/6ef5edd41f8e6cdd5bc372fc02489f7bb423d8d1/src/wp-admin/plugins.php#L124
Same thing should happen here:
https://github.com/WordPress/wordpress-develop/blob/6ef5edd41f8e6cdd5bc372fc02489f7bb423d8d1/src/wp-admin/plugins.php#L193
do_action( "activate_{$plugin}", is_network_admin() );Trac ticket: https://core.trac.wordpress.org/ticket/52405#ticket