Make WordPress Core

Opened 8 weeks ago

#44252 new defect (bug)

Missing return statement in function uninstall_plugin

Reported by: subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Plugins Keywords: has-patch 2nd-opinion
Focuses: coding-standards Cc:


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?

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)

44252.diff (315 bytes) - added by subrataemfluence 8 weeks ago.

Download all attachments as: .zip

Change History (1)

Note: See TracTickets for help on using tickets.