WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#33288 closed defect (bug) (invalid)

wp_set_current_user function does not interface correctly with WP_User constructor

Reported by: jhannwong Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0.3
Component: Users Keywords: reporter-feedback
Focuses: Cc:

Description

The fix is simple.

Line 29:

$id == $current_user->ID

If $id is a string, it evaluates to 0.

Change History (2)

#1 @helen
6 years ago

  • Keywords reporter-feedback added
  • Version changed from trunk to 2.0.3

Hi jhannwong, welcome to Trac. $id won't necessarily evaluate to 0; we probably can't change to a strict comparison here but type juggling should handle this okay with numeric strings. Can you elaborate on what you're trying to do and what's unexpected about the result?

#2 @SergeyBiryukov
6 years ago

  • Component changed from General to Users
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.