[wp-trac] [WordPress Trac] #13934: $current_user unfounded assumptions

WordPress Trac wp-trac at lists.automattic.com
Thu Jun 17 03:10:49 UTC 2010


#13934: $current_user unfounded assumptions
--------------------------+-------------------------------------------------
 Reporter:  filosofo      |       Owner:           
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  3.0.1    
Component:  Users         |     Version:  3.0      
 Severity:  normal        |    Keywords:  has-patch
--------------------------+-------------------------------------------------
 Currently, a number of places in the code (mainly in MS areas) assume that
 `$current_user` is a defined global object, when in fact that's not a safe
 assumption to make.

 For most of the cases, `$current_user` is brought into scope just to get
 the current user's ID; in that case `get_current_user_id()` is much more
 reliable.

 For the others, `$current_user` should be explicitly defined to make sure
 that
  * If it has not been instantiated, it now will be.
  * The pluggable functions get to instantiate it, if applicable.

 Patch calls `get_current_user_id()` when that's what's desired; in the
 other instances it makes sure that it is defined appropriately.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13934>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list