[wp-trac] [WordPress Trac] #20845: wp_set_current_user( null, "name") does not work when $current_user is already 0

WordPress Trac noreply at wordpress.org
Thu Oct 8 17:25:50 UTC 2015


#20845: wp_set_current_user( null, "name") does not work when $current_user is
already 0
-------------------------------------+---------------------------
 Reporter:  bobbingwide              |       Owner:  boonebgorges
     Type:  defect (bug)             |      Status:  reviewing
 Priority:  normal                   |   Milestone:  4.4
Component:  Users                    |     Version:  3.3.2
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+---------------------------

Comment (by boonebgorges):

 Thanks for the patch, bobbingwide. The strict check you've suggested will
 force a user switch in the following case:

 {{{
 wp_set_current_user( 3 );
 wp_set_current_user( '3' );
 }}}

 I don't think we want that. So we'll be a bit more precise and check for
 `$id === null`, which is how the `$id` bypass is supposed to work anyway.

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


More information about the wp-trac mailing list