[wp-trac] Re: [WordPress Trac] #6308: Plugin variable scope issue

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 22 08:27:22 GMT 2009


#6308: Plugin variable scope issue
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:                               
     Type:  defect (bug)       |      Status:  new                          
 Priority:  low                |   Milestone:  2.8                          
Component:  Administration     |     Version:  2.5                          
 Severity:  minor              |    Keywords:  dev-feedback has-patch commit
-------------------------------+--------------------------------------------

Comment(by westi):

 Replying to [comment:10 DD32]:
 > Plugins shouldnt be setting generically named global variables, nor
 executing code (aside from Plugin API functions & initiating classes) in
 global scope.

 Agreed.

 > > attachment 6308.diff added
 >  * Cleans up the $plugin variable after the plugins are included, Just
 for safty precautions for anything else which uses the $plugin variable in
 global scope elsewhere.
 >  * some extra spacing
 >
 > I feel that this would probably suffice for this ticket. Leaving the
 rest up to plugin devs best practive (of avoiding global variables in PHP)

 Looks good to me.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/6308#comment:11>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list