#44252 closed defect (bug) (invalid)
Missing return statement in function uninstall_plugin
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.1 |
| Component: | Plugins | Keywords: | has-patch 2nd-opinion close |
| Focuses: | coding-standards | Cc: |
Description
Function uninstall_plugin is missing a final return statement.
It returns true if a plugin's uninstall.php file has been found and included. But it should return false if the file is not present or not included.
Can we re-write like this?
<?php function uninstall_plugin( $plugin ) { $file = plugin_basename( $plugin ); $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); do_action( 'pre_uninstall_plugin', $plugin, $uninstallable_plugins ); if ( file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { ... return true; } if ( isset( $uninstallable_plugins[ $file ] ) ) { ... return true; //this is missing too } return false; }
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
According to the docBlock the function returns true if the
uninstall.phpfile is found and used.Only in the first conditional does this happen. There is no mention of returning false only that other options using the supplied hooks are available for use.