[wp-trac] [WordPress Trac] #64628: wp_set_current_user() is type strict determing current user

WordPress Trac noreply at wordpress.org
Fri Feb 13 02:41:24 UTC 2026


#64628: wp_set_current_user() is type strict determing current user
--------------------------------------+----------------------------
 Reporter:  peterwilsoncc             |       Owner:  peterwilsoncc
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  7.0
Component:  Users                     |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+----------------------------
Changes (by peterwilsoncc):

 * owner:  (none) => peterwilsoncc
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61633" 61633]:
 {{{
 #!CommitTicketReference repository="" revision="61633"
 Users: Ensure switching to current user doesn't reinstantiate current
 user.

 Prevent `wp_set_current_user()` from reinstantiating the current user when
 the user ID is passed as a string, eg `wp_set_current_user( (string)
 get_current_user_id() )`.

 This restores the function's previous behaviour of returning early in the
 event the IDs loosely match.

 Follow up to r57882.

 Props westonruter, peterwilsoncc.
 Fixes #64628.
 }}}

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


More information about the wp-trac mailing list