Make WordPress Core

Ticket #13585: 13585.diff

File 13585.diff, 1.9 KB (added by ryan, 15 years ago)
  • wp-admin/includes/plugin.php

     
    482482                        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
    483483                ob_start();
    484484                include(WP_PLUGIN_DIR . '/' . $plugin);
    485                 if ( ob_get_length() > 0 ) {
    486                         $output = ob_get_clean();
    487                         return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);
    488                 }
    489485                do_action( 'activate_plugin', trim( $plugin) );
    490486                if ( $network_wide ) {
    491487                        $current[$plugin] = time();
     
    497493                }
    498494                do_action( 'activate_' . trim( $plugin ) );
    499495                do_action( 'activated_plugin', trim( $plugin) );
     496                if ( ob_get_length() > 0 ) {
     497                        $output = ob_get_clean();
     498                        return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);
     499                }
    500500                ob_end_clean();
    501501        }
    502502
  • wp-admin/plugins.php

     
    334334
    335335<?php if ( isset($_GET['error']) ) :
    336336
    337         if (isset($_GET['charsout']))
    338                 $errmsg = sprintf(__('Plugin could not be activated because it generated %d characters of <strong>unexpected output</strong>.'), $_GET['charsout']);
     337        if ( isset($_GET['charsout']) )
     338                $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation.  If &#8220;headers already sent&#8221; or other strange errors start occurring, try deactivating or removing this plugin.'), $_GET['charsout']);
    339339        else
    340340                $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
    341341