Make WordPress Core

Ticket #55432: 55432.3.diff

File 55432.3.diff, 1.7 KB (added by SergeyBiryukov, 3 years ago)
  • src/wp-settings.php

     
    346346
    347347// Load must-use plugins.
    348348foreach ( wp_get_mu_plugins() as $mu_plugin ) {
     349        $_wp_plugin_file = $mu_plugin;
    349350        include_once $mu_plugin;
     351        $mu_plugin = $_wp_plugin_file; // Avoid stomping of the $mu_plugin variable in a plugin.
    350352
    351353        /**
    352354         * Fires once a single must-use plugin has loaded.
     
    357359         */
    358360        do_action( 'mu_plugin_loaded', $mu_plugin );
    359361}
    360 unset( $mu_plugin );
     362unset( $mu_plugin, $_wp_plugin_file );
    361363
    362364// Load network activated plugins.
    363365if ( is_multisite() ) {
    364366        foreach ( wp_get_active_network_plugins() as $network_plugin ) {
    365367                wp_register_plugin_realpath( $network_plugin );
     368
     369                $_wp_plugin_file = $network_plugin;
    366370                include_once $network_plugin;
     371                $network_plugin = $_wp_plugin_file; // Avoid stomping of the $network_plugin variable in a plugin.
    367372
    368373                /**
    369374                 * Fires once a single network-activated plugin has loaded.
     
    374379                 */
    375380                do_action( 'network_plugin_loaded', $network_plugin );
    376381        }
    377         unset( $network_plugin );
     382        unset( $network_plugin, $_wp_plugin_file );
    378383}
    379384
    380385/**
     
    415420// Load active plugins.
    416421foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
    417422        wp_register_plugin_realpath( $plugin );
     423
     424        $_wp_plugin_file = $plugin;
    418425        include_once $plugin;
     426        $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin.
    419427
    420428        /**
    421429         * Fires once a single activated plugin has loaded.
     
    426434         */
    427435        do_action( 'plugin_loaded', $plugin );
    428436}
    429 unset( $plugin );
     437unset( $plugin, $_wp_plugin_file );
    430438
    431439// Load pluggable functions.
    432440require ABSPATH . WPINC . '/pluggable.php';