[wp-trac] [WordPress Trac] #13903: WP_User object conditional failures
WordPress Trac
wp-trac at lists.automattic.com
Tue Jun 15 13:15:49 UTC 2010
#13903: WP_User object conditional failures
--------------------------+-------------------------------------------------
Reporter: filosofo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0.1
Component: Users | Version: 3.0
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
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
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13903>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list