WordPress.org

Make WordPress Core

Ticket #13786: notice.diff

File notice.diff, 756 bytes (added by scribu, 5 years ago)

don't allow object methods as callbacks

  • wp-includes/plugin.php

     
    659659 * @param callback $callback The callback to run when the hook is called. 
    660660 */ 
    661661function register_uninstall_hook($file, $callback) { 
     662        if ( is_array( $callback ) && is_object( $callback[0] ) ) { 
     663                _deprecated_argument( __FUNCTION__, '3.1', __('Usage of object methods as uninstall hooks is deprecated. Use a static method or a function instead.') ); 
     664                return false; 
     665        } 
     666 
    662667        // The option should not be autoloaded, because it is not needed in most 
    663668        // cases. Emphasis should be put on using the 'uninstall.php' way of 
    664669        // uninstalling the plugin.