[wp-trac] [WordPress Trac] #31104: Plugin activation includes plugin file in variable scope of activate_plugin
WordPress Trac
noreply at wordpress.org
Fri Jan 23 23:23:25 UTC 2015
#31104: Plugin activation includes plugin file in variable scope of activate_plugin
--------------------------+--------------------
Reporter: Mike_Cowobo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.2
Component: Plugins | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+--------------------
Comment (by Mike_Cowobo):
@dd32: I agree that it generally shouldn't happen, but the behaviour is
unexpected, because it differs from how plugins are included during the
normal WP bootstrap. This makes it hard to debug problem arising from
defining variables in your main plugin file.
Though it is recommended and best practice to have a root plugin file do
nothing more than bootstrap the plugin by setting some actions and filters
(or better yet, hooking the bootstrap into `plugins_loaded`), it is not
imperative that a plugin author doesn't work with any variables during the
bootstrap. I think a lot of developer headache can be spared by simply
taking the plugin file out of the var scope of `activate_plugin`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31104#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list