Closed raicem closed 1 year ago
@raicem Planning to finish this one up?
Yes @danielbachhuber. I struggled to figure out tests. Can I get another week? Otherwise I'll close the PR.
@raicem Yep, take your time. Feel free to stop by the #cli
channel on WordPress.org Slack if you'd like help further.
@danielbachhuber Thank you for your patience with this :bow: I managed to write a test for this regression now. I hope it makes sense!
While reported in the original issue #348, I can't replicate the type problem with wp plugin deactivate
. When deactivating, WP CLI doesn't (and probably can't) cause a type error since the value it passes down to the deactivate_plugins
function is not used later in the code.
This is not the case when activating a plugin. The $network_wide
variable we pass to activate_plugin
is directly passed down to the activate_{$plugin}
hook and causes a type error. Therefore I only fixed and added a test for wp plugin activate
.
While reported in the original issue #348, I can't replicate the type problem with
wp plugin deactivate
. When deactivating, WP CLI doesn't (and probably can't) cause a type error since the value it passes down to thedeactivate_plugins
function is not used later in the code.This is not the case when activating a plugin. The
$network_wide
variable we pass toactivate_plugin
is directly passed down to theactivate_{$plugin}
hook and causes a type error. Therefore I only fixed and added a test forwp plugin activate
.
Thanks for digging into this!
IIRC I originally ran into this with the activate
command, but included deactivate
in the bug report too so that we check whether it's affected as well. So thanks for confirming that the deactivate
command is not affected!
Thank you @swissspidy for the explanation!
My tests failed, probably because the example code in my test doesn't play nicely with PHP 5.6. I'll check that and fix it later today.
Fixes #348
For the
activate
command, we're defaulting the$network_wide
option toNULL
if the--network
flag is omitted. This causes type errors further down in the code, as shown in issue #348.I thought about doing the same for the
deactivate
command as well, but for deactivation, passingnull
is probably what we should keep since it has its own meaning in the WordPress'deactivate_plugins
function.