craft-plugin-commands
craft-plugin-commands copied to clipboard
[bug] Attempting to uninstall a plugin that is not installed does not throw an error
This is probably a fairly inconsequential bug, but it caught me today (due to a typo I made in a plugin handle) so thought I'd raise it.
Using plugin/uninstall to attempt to uninstall a craft plugin that is not installed does not throw an error when the command is run.
i.e.:
$ ./craft plugin/uninstall non-existent-plugin-handle
gives:
> Uninstalled non-existent-plugin-handle successfully
i.e. a false positive success
Craft's Plugins service throws an InvalidPluginException which from a quick look it looks like your code should catch, so it's not 100% obvious why this is happening.
Let me know if you want me to make a reduced test case.
Oh, Craft introduced its own plugin/* commands now. They use the same try/catch https://github.com/craftcms/cms/blob/3.5/src/console/controllers/PluginController.php#L66-L71 and it fails (with success) the same way. All other commands work as expected for unknown plugins.
This is the reason: https://github.com/craftcms/cms/blob/3.5/src/services/Plugins.php#L571
I believe this is a Craft CMS core issue based on this issue