Opened 12 months ago
#1526 new defect
[ sponsors-slideshow-widget] register_uninstall_hook called incorrectly
| Reported by: | kitchin | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | not-listed |
| Severity: | normal | Keywords: | sponsors-slideshow-widget uninstall |
| Cc: |
Description
From WP 3.3.2 in DEBUG mode:
Notice: register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.) in .../wp-includes/functions.php on line 3587
The offending code is at sponsors-slideshow-widget.php, line 57:
register_uninstall_hook(__FILE__, array(&$this, 'uninstall'));
Apparently uninstall never worked when called this way, and http://core.trac.wordpress.org/ticket/13786 added the warning and an early return.
Sponsors Slideshow Widget has been at wordpress.org since [297357] but is not a listed component. http://www.wordpress.org/extend/plugins/sponsors-slideshow-widget
This simple patch should work (sorry, don't have SVN):
- delete line 57
- add a new file, uninstall.php:
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
delete_option( 'sponsors_slideshow_widget' );
- For cleanup, delete the "uninstall" function at line 312.
- Also, fix a typo at line 344:
// wp_register_script( 'sponsors-slideshow', $this->plugin_url.'/sponsors-slideshow-widget.js', array(), $ths->version ); wp_register_script( 'sponsors-slideshow', $this->plugin_url.'/sponsors-slideshow-widget.js', array(), $this->version );
