#13903 closed defect (bug) (fixed)
WP_User object conditional failures
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0.1 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Users | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
A number of places check whether a user object has instantiated the data of an actual user by either checking whether the user object is empty or falsely. Both checks will fail to come to the correct conclusion because $user
is an object that has default properties and methods.
$user = new WP_User( 0 ); // not a user's ID var_dump( empty( $user ) ); // false! var_dump( ! $user ); // false ! var_dump( empty( $user->ID ) ); // true; that's more like it
Attachments (1)
Note: See
TracTickets for help on using
tickets.
Looks good.