[wp-trac] [WordPress Trac] #44252: Missing return statement in function uninstall_plugin
WordPress Trac
noreply at wordpress.org
Mon May 28 13:16:53 UTC 2018
#44252: Missing return statement in function uninstall_plugin
------------------------------+-----------------------------------
Reporter: subrataemfluence | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: trunk
Severity: normal | Keywords: has-patch 2nd-opinion
Focuses: coding-standards |
------------------------------+-----------------------------------
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
<?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;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44252>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list