[Bb-trac] [bbPress] #1017: for backwards compatibility $bb_current_user should be emptied if null

bbPress bb-trac at lists.bbpress.org
Mon Dec 22 15:20:32 GMT 2008


#1017: for backwards compatibility $bb_current_user should be emptied if null
----------------------+-----------------------------------------------------
 Reporter:  _ck_      |       Owner:                    
     Type:  defect    |      Status:  new               
 Priority:  normal    |   Milestone:  1.0-beta & XML-RPC
Component:  Back-end  |     Version:  1.0-alpha-2       
 Severity:  normal    |    Keywords:                    
----------------------+-----------------------------------------------------
 Took me quite awhile to track this bug down.

 Several plugins use !$bb_current_user to test if there is a logged in user
 or not (regardless that it's a bad approach - because of lack of
 documentation).

 In 1.0 the simple $bb_current_user string became  a mapping of
 `$bb_current_user` to `$wp_auth_object->get_current_user()`

 The problem is in some cases if the current user is 0 or null,
 $bb_current_user will then become a full formed user object with all zeros
 or nulls for the attributes. This makes !$bb_current_user fail because
 it's not empty per se.

 even  empty($bb_current_user) will fail because it's got complex object
 data inside (all null but still).

 So perhaps function get_current_user should double check if the `->ID` is
 zero or null and zap the result to unset instead of letting it remain an
 empty structure, so it doesn't cause older plugins to fail.

-- 
Ticket URL: <http://trac.bbpress.org/ticket/1017>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list