Closed swissspidy closed 1 year ago
Describe the current, buggy behavior
When calling wp plugin activate or wp plguin deactivate without explicitly pass --network, $network_wide will be null instead of false.
wp plugin activate
wp plguin deactivate
--network
$network_wide
null
false
This causes errors if a plugin uses parameter types like this:
function myplugin_activate( bool $network_wide = false ): void { // ... } register_activation_hook( __FILE__, 'myplugin_activate' );
https://github.com/wp-cli/extension-command/blob/266d53d87f9c381677137cc79ed7805c9c0162a5/src/Plugin_Command.php#L311
https://github.com/wp-cli/extension-command/blob/266d53d87f9c381677137cc79ed7805c9c0162a5/src/Plugin_Command.php#LL402C2-L402C2
Describe how other contributors can replicate this bug
Describe what you would expect as the correct outcome
No errors
Let us know what environment you are running this on
(Paste the output of "wp cli info" into this box)
Provide a possible solution
$network_wide should default to false so it's always a bool
bool
Provide additional context/Screenshots
Add any other context about the problem here.
If applicable, add screenshots to help explain (you can just drag&drop images into the Github issue).
I'll look into this issue during the WCEU Contributor day 2023.
Bug Report
Describe the current, buggy behavior
When calling
wp plugin activate
orwp plguin deactivate
without explicitly pass--network
,$network_wide
will benull
instead offalse
.This causes errors if a plugin uses parameter types like this:
https://github.com/wp-cli/extension-command/blob/266d53d87f9c381677137cc79ed7805c9c0162a5/src/Plugin_Command.php#L311
https://github.com/wp-cli/extension-command/blob/266d53d87f9c381677137cc79ed7805c9c0162a5/src/Plugin_Command.php#LL402C2-L402C2
Describe how other contributors can replicate this bug
Describe what you would expect as the correct outcome
No errors
Let us know what environment you are running this on
Provide a possible solution
$network_wide
should default tofalse
so it's always abool
Provide additional context/Screenshots
Add any other context about the problem here.
If applicable, add screenshots to help explain (you can just drag&drop images into the Github issue).