[wp-trac] [WordPress Trac] #52076: Checking anonymous user's exist capability returns inconsistent results across functions.
WordPress Trac
noreply at wordpress.org
Thu Dec 24 04:30:53 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: early has-patch | Focuses:
-----------------------------+------------------------------
Comment (by johnjamesjacoby):
Hey gents!
@johnbillion I remember, but also not fully. Maybe related to
`init_roles()` of `init_caps()` and site switching? Maybe related to a WP
User Profiles thing?
@peterwilsoncc I’m following the code changes in the pull request, and
they make perfect sense to me. If BuddyPress needs an internal change to
accommodate it, I’m happy to see that through.
The `exist()` method name is an unfortunate collision against the cap key
name. Given the intent of the capability, it could simply always return
true, but given the intent of the method that’s obviously not correct.
I don’t think anything needs renaming (it probably would not be very easy
to do) but I can imagine others arguing for improved clarity eventually,
so it’s worth acknowledging that `::exists()` and `caps[‘exists’]`
definitely do different things, perhaps adding even more verbose
documentation in the code.
I am comfortable committing this early in trunk if others are. It’s the
kind of low-level change that may have unintended consequences, and it
seems proper to plan for potential revisions or reverting.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52076#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list