[wp-trac] [WordPress Trac] #45845: Use get_user_by in check_password_reset_key

WordPress Trac noreply at wordpress.org
Thu Mar 7 00:10:55 UTC 2019


#45845: Use get_user_by in check_password_reset_key
--------------------------------------+-----------------------------
 Reporter:  spacedmonkey              |       Owner:  SergeyBiryukov
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  5.2
Component:  Users                     |     Version:  3.1
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:  performance
--------------------------------------+-----------------------------

Comment (by davidbaumwald):

 After digging into this a bit more, caching is definitely the cause of the
 failure.  Series of events as follows:
 1. User row is updated in the database with a generated activation key.
 2. Assertion that `check_password_reset_key` is not `WP_Error` fails.

 Failure is due to the updated code using cached user data.  At the time of
 the above assertion, the `user_activation_key` is empty.

 Expanding upon what @desrosj added, if I add `clean_user_cache` right
 after the activation key is created, the tests pass.  Maybe that's the
 solution?

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


More information about the wp-trac mailing list