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

WordPress Trac noreply at wordpress.org
Thu Feb 28 12:15:25 UTC 2019


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

Comment (by williampatton):

 @davidbaumwald

 The `if ( false === $user )` is followed up by casting data to a different
 $var and then testing ` if ( ! $row )`. I think we could have both tests
 performed in a single block.

 `if ( false === $user || ! $user->data )` could work here instead. Since
 the same error is thrown on both the tests and no additional context is
 added to the error message I would prefer to test both at the same time is
 all.

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


More information about the wp-trac mailing list