[wp-trac] [WordPress Trac] #44884: Notice something like "Notice: Constant WP_UNINSTALL_PLUGIN already defined in testsite\wp-admin\includes\plugin.php on line 1016" appears when try to delete multiple plugins by "delete_plugins()" function

WordPress Trac noreply at wordpress.org
Mon Sep 3 06:18:33 UTC 2018


#44884: Notice something like "Notice: Constant WP_UNINSTALL_PLUGIN already defined
in testsite\wp-admin\includes\plugin.php on line 1016" appears when try to
delete multiple plugins by "delete_plugins()" function
--------------------------+-----------------------------
 Reporter:  pmbaldha      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  4.9.8
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When i try to uninstall multiple plugins, I am getting warning like
 "Notice: Constant WP_UNINSTALL_PLUGIN already defined in testsite\wp-
 admin\includes\plugin.php on line 1016".

 To demonstrate this issue i have developed testcode.

 Issue reproduce steps:
 * Please ensure that debug mode is on in your WordPress setup by ensuring
 below constant is on root/wp-config.php file:

 {{{#!php
 <?php
 define('WP_DEBUG', true);
 }}}


 * Install these plugins: Contact Form 7, Gutenberg, Jetpack by
 WordPress.com, WooCommerce and Yoast SEO

 * Please make new file as wp-content/mu-plugins/test.php and pate below
 code in it:

 {{{#!php
 <?php
 add_action('admin_init', function() {

     if (isset($_GET['t']) && 1 == $_GET['t']) {
         $uninstallable_plugins = array(
             'contact-form-7/wp-contact-form-7.php',
             'gutenberg/gutenberg.php',
             'jetpack/jetpack.php',
             'woocommerce/woocommerce.php',
             'wordpress-seo/wp-seo.php',
         );

         var_dump(delete_plugins($uninstallable_plugins));

         die;
     }

 });

 }}}

 * Open browser and open the address "yoursite.com/wp-admin/?t=1" and you
 will see error

 https://photos.app.goo.gl/BHeCDSF4uB2Eh4HNA

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44884>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list