-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default to false when the "network" flag is omitted in the activate command #364
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add feature tests covering this scenario for both wp plugin activate
and wp plugin deactivate
?
@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 |
62ea477
to
e376a64
Compare
@danielbachhuber Thank you for your patience with this 🙇 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 This is not the case when activating a plugin. The |
Since we were not defaulting to a boolean value, the $network_wide variable was null, when the `--network` flag was omitted. This causes type errors when activated plugins run their activation hooks and they expect a boolean value for the $network_wide variable, as illustrated in issue wp-cli#348.
Thanks for digging into this! IIRC I originally ran into this with the |
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. |
Also added STDERR check for completenes, as suggested by @swissspidy. Co-authored-by: Pascal Birchler <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this, @raicem !
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.