[wp-trac] [WordPress Trac] #58188: is_user_logged_in can cause null pointer exception
WordPress Trac
noreply at wordpress.org
Mon Apr 24 20:20:28 UTC 2023
#58188: is_user_logged_in can cause null pointer exception
---------------------------+-----------------------------
Reporter: preissdigital | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.2
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
The `wp_get_current_user` has as documented return type a `WP_User`
object. But it returns the result from `_wp_get_current_user` where the
result can also be `0`. The problem is, that the `is_user_logged_in`
function try to return `$user->exists()`. There should be a check like `0
!== $user`, `$user instanceof \WP_User` or something similar.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58188>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list