[wp-trac] [WordPress Trac] #28020: get_userdata and wp_get_current_user do not share WP_User instance

WordPress Trac noreply at wordpress.org
Fri Apr 23 00:41:08 UTC 2021


#28020: get_userdata and wp_get_current_user do not share WP_User instance
--------------------------------------------+-----------------------
 Reporter:  rmccue                          |       Owner:  (none)
     Type:  defect (bug)                    |      Status:  new
 Priority:  normal                          |   Milestone:  5.8
Component:  Users                           |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  has-patch has-unit-tests early  |     Focuses:  rest-api
--------------------------------------------+-----------------------
Changes (by peterwilsoncc):

 * keywords:  has-patch has-unit-tests early needs-refresh => has-patch has-
     unit-tests early


Comment:

 The [https://github.com/WordPress/wordpress-develop/pull/880 linked pull
 request] makes the following changes from [attachment:"28020.2.diff"] :

 * reverted the new `$force` parameter in the original patch on
 `wp_set_current_user()` to avoid changing the signature of a pluggable
 function
 * force refresh the current user's object as part of `clean_user_cache()`
 per original patch but using a different technique
 * `clean_user_cache()` immediately rewarms the current user's cache as a
 result of above. Strictly speaking the function is meant to clean rather
 than clear but it is a backward compatibility change
 * switched to strict comparisons in a few places

 I think this is good to go in but given I've made a few changes it would
 be good to get another set of eyes on it.

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


More information about the wp-trac mailing list