### Eclipse Workspace Patch 1.0
#P wordpress-trunk
Index: wp-admin/includes/plugin.php
===================================================================
--- wp-admin/includes/plugin.php	(revision 12605)
+++ wp-admin/includes/plugin.php	(working copy)
@@ -258,8 +258,8 @@
  * @param string $plugin Base plugin path from plugins directory.
  * @return bool True, if in the active plugins list. False, not in the list.
  */
-function is_plugin_active($plugin) {
-	return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
+function is_plugin_active( $plugin ) {
+	return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) );
 }
 
 /**
@@ -286,9 +286,9 @@
  * @param string $redirect Optional. URL to redirect to.
  * @return WP_Error|null WP_Error on invalid file or null on success.
  */
-function activate_plugin($plugin, $redirect = '') {
-	$current = get_option('active_plugins');
-	$plugin = plugin_basename(trim($plugin));
+function activate_plugin( $plugin, $redirect = '' ) {
+	$current = get_option( 'active_plugins', array() );
+	$plugin  = plugin_basename( trim( $plugin ) );
 
 	$valid = validate_plugin($plugin);
 	if ( is_wp_error($valid) )
@@ -322,13 +322,10 @@
  * @param string|array $plugins Single plugin or list of plugins to deactivate.
  * @param bool $silent Optional, default is false. Prevent calling deactivate hook.
  */
-function deactivate_plugins($plugins, $silent= false) {
-	$current = get_option('active_plugins');
+function deactivate_plugins( $plugins, $silent = false ) {
+	$current = get_option( 'active_plugins', array() );
 
-	if ( !is_array($plugins) )
-		$plugins = array($plugins);
-
-	foreach ( $plugins as $plugin ) {
+	foreach ( (array) $plugins as $plugin ) {
 		$plugin = plugin_basename($plugin);
 		if( ! is_plugin_active($plugin) )
 			continue;
@@ -475,26 +472,32 @@
 	return true;
 }
 
+/**
+ * validate active plugins
+ * 
+ * validate all active plugins, deactivates invalid and 
+ * returns an array of deactived ones.
+ * 
+ * @since unknown
+ * @return array invalid plugins, plugin as key, error as value
+ */
 function validate_active_plugins() {
-	$check_plugins = apply_filters( 'active_plugins', get_option('active_plugins') );
+	$plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
 
-	// Sanity check.  If the active plugin list is not an array, make it an
-	// empty array.
-	if ( !is_array($check_plugins) ) {
+	// validate vartype: array
+	if ( !is_array( $plugins ) ) {
 		update_option('active_plugins', array());
 		return;
 	}
 
-	//Invalid is any plugin that is deactivated due to error.
 	$invalid = array();
 
-	// If a plugin file does not exist, remove it from the list of active
-	// plugins.
-	foreach ( $check_plugins as $check_plugin ) {
-		$result = validate_plugin($check_plugin);
+	// invalid plugins get deactivated
+	foreach ( $plugins as $plugin ) {
+		$result = validate_plugin( $plugin );
 		if ( is_wp_error( $result ) ) {
-			$invalid[$check_plugin] = $result;
-			deactivate_plugins( $check_plugin, true);
+			$invalid[$plugin] = $result;
+			deactivate_plugins( $plugin, true );
 		}
 	}
 	return $invalid;
Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 12605)
+++ wp-settings.php	(working copy)
@@ -581,7 +581,7 @@
 		require(ABSPATH . 'my-hacks.php');
 }
 
-$current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
+$current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
 if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) {
 	foreach ( $current_plugins as $plugin ) {
 		// check the $plugin filename
Index: wp-admin/plugin-editor.php
===================================================================
--- wp-admin/plugin-editor.php	(revision 12605)
+++ wp-admin/plugin-editor.php	(working copy)
@@ -208,7 +208,7 @@
 		<div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
 		<?php endif; ?>
 <?php if ( is_writeable($real_file) ) : ?>
-	<?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
+	<?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?>
 		<p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
 	<?php } ?>
 	<p class="submit">
Index: wp-includes/update.php
===================================================================
--- wp-includes/update.php	(revision 12605)
+++ wp-includes/update.php	(working copy)
@@ -112,7 +112,7 @@
 		require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
 
 	$plugins = get_plugins();
-	$active  = get_option( 'active_plugins' );
+	$active  = get_option( 'active_plugins', array() );
 	$current = get_transient( 'update_plugins' );
 	if ( ! is_object($current) )
 		$current = new stdClass;
@@ -147,7 +147,7 @@
 	$current->last_checked = time();
 	set_transient( 'update_plugins', $current );
 
-	$to_send = (object)compact('plugins', 'active');
+	$to_send = (object) compact('plugins', 'active');
 
 	$options = array(
 		'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
Index: wp-includes/ms-functions.php
===================================================================
--- wp-includes/ms-functions.php	(revision 12605)
+++ wp-includes/ms-functions.php	(working copy)
@@ -2232,13 +2232,6 @@
 	return false;
 }
 
-function fix_active_plugins( $value ) {
-	if( false == is_array( $value ) )
-		$value = array();
-	return $value;
-}
-add_filter( "option_active_plugins", "fix_active_plugins" );
-
 if ( !function_exists('rss_gc') ) :
 function rss_gc() {
 	global $wpdb;
