[wp-trac] [WordPress Trac] #31104: Plugin activation includes plugin file in variable scope of activate_plugin
WordPress Trac
noreply at wordpress.org
Wed Mar 18 03:36:05 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: 4.2
Component: Plugins | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------
Comment (by 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31104#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list