`determine_current_user` filter should return `false` not `null`
-
Hi.
WO_Server::wp_oauth_authenticate_bypass()
which is hooked to thedetermine_current_user
filter returnsnull
, which is incorrect/undesirable. Similarly,class-wo-api.php:309
runsapply_filters
ondetermine_current_user
withnull
as the input.Where WordPress uses
determine_current_user
, e.g._wp_get_current_user()
, the value passed when the user id is not known isfalse
, and the documentation says:@param int|false $user_id User ID if one has been determined, false otherwise.
https://github.com/WordPress/WordPress/blob/17e2eff4aa3beb2802cbec12b6f08e2fbf69893d/wp-includes/user.php#L3618Similarly
false
is used/expected in wp_validate_logged_in_cookie(), wp_validate_application_password(), and wp_validate_auth_cookie().I came across this when I had strongly typed a function I had added to the
determine_current_user
filter and got a 500 error when the value came from WP OAuth. It would be nice if the code were to match the WordPress convention.Thanks.
- The topic ‘`determine_current_user` filter should return `false` not `null`’ is closed to new replies.