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

WordPress Trac noreply at wordpress.org
Mon Apr 6 21:30:49 UTC 2015


#31104: Plugin activation includes plugin file in variable scope of activate_plugin
--------------------------+-----------------------------
 Reporter:  Mike_Cowobo   |       Owner:  dd32
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  Future Release
Component:  Plugins       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------------
Changes (by DrewAPicture):

 * milestone:  4.2 => Future Release


Comment:

 Replying to [comment:6 dd32]:
 > I'm still not 100% convinced that we actually need to change anything
 here honestly, but I'll not repeat the same bad-practices arguments.
 > However, I'll note that shifting activation to occur via a different
 function, adds no real overhead, nor downsides that can't be worked
 around.
 >
 > The patch as-is, can't be applied, as it's got back-compat concerns.
 > Those concerns are that it no longer has access to the same variables
 that it previously did, so something like this would be needed (although I
 dislike the usage of extract, which we're trying to avoid).
 > {{{
 > acivate_plugin(..):
 >    ...
 >    do_activate_plugin( $plugin, get_defined_vars() );
 >    ...
 > do_activate_plugin( $plugin, $vars ):
 >   extract $vars;
 >   include $plugin;
 > }}}
 > The plugin still has access to the same scoped variables it previously
 did, but is no longer able to modify them.
 >

 OK, let's pick this up in 4.3 then. @dd32: Feel free to pull it back into
 4.2 if you think that would be better than waiting.

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


More information about the wp-trac mailing list