[wp-trac] [WordPress Trac] #19769: $userdata is not empty for anonymous requests

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 7 13:01:07 UTC 2012


#19769: $userdata is not empty for anonymous requests
--------------------------+-----------------------------
 Reporter:  MattyRob      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:  3.3
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 When an anonymous user visit a WordPress 3.3.x installation (i.e. a user
 who has not logged in) the $userdata global variable is set but virtually
 unpopulated.

 In previous versions of WordPress (3.2.1 checked) the $userdata variable
 returns NULL. In the 3.3 branch it returns the following:

 {{{
 object(WP_User)#251 (7) {
   ["data"]=>
   NULL
   ["ID"]=>
   int(0)
   ["caps"]=>
   array(0) {
   }
   ["cap_key"]=>
   NULL
   ["roles"]=>
   array(0) {
   }
   ["allcaps"]=>
   array(0) {
   }
   ["filter"]=>
   NULL
 }
 }}}

 Is this expected behaviour? I would have though $userdata should be NULL
 for visits from users who are not logged in.

 I tested with this simple plugin:

 {{{
 function ud_check() {
         global $userdata;
         var_dump($userdata);
 }

 add_action('shutdown', 'ud_check');
 }}}

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


More information about the wp-trac mailing list