[wp-trac] [WordPress Trac] #18458: calling is_user_logged_in() when logged-out throws PHP notice
WordPress Trac
wp-trac at lists.automattic.com
Wed Aug 17 08:35:58 UTC 2011
#18458: calling is_user_logged_in() when logged-out throws PHP notice
------------------------------+-----------------------------
Reporter: wonderboymusic | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Warnings/Notices | Version:
Severity: normal | Keywords: has-patch
------------------------------+-----------------------------
calling wp_get_current_user() when no user is logged in does not produce a
User object, yet is_user_logged_in() tries to read the the id property of
$user on every call to this function, whether an object exists or not.
This produces the following notice in the logs when error_reporting is set
to -1
{{{ PHP Notice: Trying to get property of non-object in
/Users/scott/Sites/emusic/trunk/wordpress/wp-includes/pluggable.php on
line 758 }}}
The function is triggered by all calls to $WP_Query->get_posts() and will
produce an obscene number of notices in error logs on high traffic sites.
As an example, every XML-RPC made on eMusic.com produces this Notice in
our logs.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18458>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list