[wp-trac] [WordPress Trac] #25672: is_a() causing errors with get_users()
WordPress Trac
noreply at wordpress.org
Thu Oct 24 17:44:49 UTC 2013
#25672: is_a() causing errors with get_users()
------------------------------+------------------------------
Reporter: dgdax | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Warnings/Notices | Version: 3.6.1
Severity: normal | Resolution:
Keywords: needs-patch |
------------------------------+------------------------------
Comment (by johnbillion):
I believe `is_a()` is the preferred method due to errors that can arise
with `instanceof` negation. Example:
Correct:
`if ( ! is_a( $user, 'WP_User' ) )`
Incorrect, but not obviously so:
`if ( ! $user instanceof 'WP_User' )`
The correct syntax for negation when using `instanceof` is:
`if ( ! ( $user instanceof 'WP_User' ) )`
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25672#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list