From 320ac834de256fb5c54b043cf5c4cba72422b7a9 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 25 Jan 2007 20:45:20 +0000 Subject: [PATCH] Prevent plugins that generate PHP fatal errors from being activated. ticket #3254 git-svn-id: https://develop.svn.wordpress.org/trunk@4811 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/plugins.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 94d461d3e5..25d320fb84 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -11,13 +11,14 @@ if ( isset($_GET['action']) ) { if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) wp_die(__('Plugin file does not exist.')); if (!in_array($plugin, $current)) { + wp_redirect('plugins.php?error=true'); // we'll override this later if the plugin can be included without fatal error + @include(ABSPATH . PLUGINDIR . '/' . $plugin); $current[] = $plugin; sort($current); update_option('active_plugins', $current); - include(ABSPATH . PLUGINDIR . '/' . $plugin); do_action('activate_' . $plugin); } - wp_redirect('plugins.php?activate=true'); + wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above } else if ('deactivate' == $_GET['action']) { check_admin_referer('deactivate-plugin_' . $_GET['plugin']); $current = get_option('active_plugins'); @@ -58,13 +59,12 @@ foreach ($check_plugins as $check_plugin) { } ?> - -

activated.') ?>

-
- - -

deactivated.') ?>

-
+ +

fatal error.') ?>

+ +

activated.') ?>

+ +

deactivated.') ?>