ostark / craft-plugin-commands

Manage Craft plugins from the cli
19 stars 1 forks source link

[bug] Attempting to uninstall a plugin that is not installed does not throw an error #2

Open tomdavies opened 4 years ago

tomdavies commented 4 years ago

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.

ostark commented 4 years ago

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

jamesmacwhite commented 2 years ago

I believe this is a Craft CMS core issue based on this issue