Make WordPress Core


Ignore:
Timestamp:
02/16/2010 03:44:20 AM (15 years ago)
Author:
markjaquith
Message:

Detect plugin output on activation, as well as fatal errors. props miqrogroove. fixes #12089

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin.php

    r13155 r13167  
    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();
    361         @include(WP_PLUGIN_DIR . '/' . $plugin);
     361        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.'), $output);
     365        }
    362366        do_action( 'activate_plugin', trim( $plugin) );
    363367        if ( $network_wide ) {
Note: See TracChangeset for help on using the changeset viewer.