[wp-trac] [WordPress Trac] #52076: Checking anonymous user's exist capability returns inconsistent results across functions.

WordPress Trac noreply at wordpress.org
Tue Dec 15 22:11:57 UTC 2020


#52076: Checking anonymous user's exist capability returns inconsistent results
across functions.
-----------------------------+------------------------------
 Reporter:  peterwilsoncc    |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Role/Capability  |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by peterwilsoncc):

 Following up on the notes above with night brain thoughts:

 {{{
 $anon_user->exists();
 }}}

 The exists (plural) function is to check if the user exists in the
 database. The logged out user does not so this is returning `false` as
 expected.

 {{{
 // With current user set to logged out
 user_can( 0, 'exist' );
 current_user_can( 'exist' );
 }}}

 Both of these in there various forms ought to return `true` as they are
 checking the `exist` capability which both logged in and logged out users
 have.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52076#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list