[wp-trac] [WordPress Trac] #6332: deactivate_plugins() bug (file: / wp-admin/include/plugins.php)

WordPress Trac wp-trac at lists.automattic.com
Fri Mar 21 11:27:30 GMT 2008


#6332: deactivate_plugins() bug (file: / wp-admin/include/plugins.php)
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:  anonymous
     Type:  defect             |      Status:  new      
 Priority:  low                |   Milestone:           
Component:  Administration     |     Version:  2.5      
 Severity:  minor              |    Keywords:           
-------------------------------+--------------------------------------------
 there's an issue with the Array-fu! stuff:

 {{{
 $plugin = 'invalid_plugin.php';
 $current = array('active_plugin.php');
 var_dump($current); // array('active_plugin.php')
 array_splice($current, array_search( $plugin, $current), 1 ); // Array-fu!
 var_dump($current); // array()

 }}}

 this line:


 {{{
 array_splice($current, array_search( $plugin, $current), 1 ); // Array-fu!

 }}}

 should be replaced by:


 {{{
 if ( ( $key = array_search( $plugin, $current) ) !== false )
         array_splice($current, $key, 1 ); // Fixed Array-fu!

 }}}

 as it stands, deactivating an invalid plugin removes the first plugin from
 the list. and deactivating a whole list of invalid plugins produces
 unpredictable results.

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


More information about the wp-trac mailing list