Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#28019 closed defect (bug) (fixed)

WP_User does not initialise data to a sane value

Reported by: rmccue's profile rmccue Owned by: dd32's profile dd32
Milestone: 4.2 Priority: normal
Severity: minor Version:
Component: Users Keywords:
Focuses: Cc:

Description (last modified by rmccue)

If I do new WP_User(), I'd expect to be able to do things like $user->user_login = "x" without causing an error. However, the $data property used internally is not initialised to an empty object, causing a "Creating default object from empty value" error.

Change History (3)

#1 @rmccue
10 years ago

  • Description modified (diff)

#2 @dd32
9 years ago

  • Milestone changed from Awaiting Review to 4.2

#3 @dd32
9 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 31049:

Preinitialize WP_User::$data to an object in the event an empty user object is created. Avoids a "Creating default object from empty value" PHP Warning.
Fixes #28019

Note: See TracTickets for help on using tickets.