[wp-trac] [WordPress Trac] #31104: Plugin activation includes plugin file in variable scope of activate_plugin

WordPress Trac noreply at wordpress.org
Sat Apr 24 18:02:53 UTC 2021


#31104: Plugin activation includes plugin file in variable scope of activate_plugin
-----------------------------+-----------------------------
 Reporter:  Mike_Cowobo      |       Owner:  SergeyBiryukov
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:  5.8
Component:  Plugins          |     Version:  4.2
 Severity:  normal           |  Resolution:  fixed
 Keywords:  has-patch early  |     Focuses:
-----------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"50787" 50787]:
 {{{
 #!CommitTicketReference repository="" revision="50787"
 Plugins: When loading a plugin in a "sandbox" on activation, do it in a
 separate function.

 This avoids accidentally overriding some variables in the scope of
 `activate_plugin()`, e.g. `$silent` or `$network_wide`.

 Plugins expecting to have access to `$network_wide` directly on inclusion
 should receive it as an argument of the activation hook callback instead,
 on any of these actions:

 * `activate_plugin`
 * `activate_{$plugin}`
 * `activated_plugin`

 Follow-up to [28644].

 Props Mike_Cowobo, dd32, DrewAPicture, mensmaximus, SergeyBiryukov.
 Fixes #31104.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/31104#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list