[wp-trac] [WordPress Trac] #16562: sometimes deactivation of plugin deactivates another

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 15 05:10:03 UTC 2011


#16562: sometimes deactivation of plugin deactivates another
--------------------------+--------------------------------------
 Reporter:  Ghost_ufa     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.1
 Severity:  major         |   Keywords:  plugin deactivation miss
--------------------------+--------------------------------------
 in some cases of plugin's mailfunctions serialized list of active plugins
 has gaps in index - ex. 14 15 17 18
 Current WP realisation don't correct it and can't work correctly, and
 occures deactivation of incorrect plugin.

 resolution:

 file wp-admin/includes/plugin.php
 function deactivate_plugins

 is:

 {{{
                 if ( $network_wide ) {
                         $do_network = true;
                         unset( $network_current[ $plugin ] );
                 } else {
                         $key = array_search( $plugin, $current );
                         if ( false !== $key ) {
                                 $do_blog = true;
                                 array_splice( $current, $key, 1 );
                         }
                 }
 }}}

 should be:
 unset( $network_current[ $key ] );

 instead of
 array_splice( $current, $key, 1 );


 And after loop, just before "if ( $do_blog )", add index renumbering like
 this:


 {{{
         $i=0;       $new_current=array();
         foreach ( (array) $current as $cur ) $new_current[$i++]=$cur;
         $current=$new_current;

 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16562>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list