WordPress.org

Make WordPress Core

Ticket #12089: plugin-activation.patch

File plugin-activation.patch, 798 bytes (added by miqrogroove, 6 years ago)
  • wp-admin/includes/plugin.php

     
    359359                        wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error 
    360360                ob_start(); 
    361361                @include(WP_PLUGIN_DIR . '/' . $plugin); 
     362                if ( ob_get_length() > 0 ) { 
     363                        $output = ob_get_clean(); 
     364                        return new WP_Error('unexpected_output', __('The plugin generated unexpected output.') . '<br />' . htmlspecialchars($output)); 
     365                } 
    362366                do_action( 'activate_plugin', trim( $plugin) ); 
    363367                if ( $network_wide ) { 
    364368                        $current[$plugin] = time();