Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#39428 new defect (bug)

Die fast in get_posts if get_user_by returns false

Reported by: davidbinda's profile david.binda Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: Query Keywords: has-patch has-unit-tests needs-testing
Focuses: Cc:


In case a username in the URL or passed to WP_Query via any other way is invalid - such a user is not in database - the code currently casts the false value returned from get_user_by to 0 via absint - see

Instead of trying to query unassigned posts (with post_author equal to 0) for all invalid usernames, the query should die fast and return no posts.

Attachments (1)

39428.diff (1.6 KB) - added by david.binda 7 years ago.

Download all attachments as: .zip

Change History (3)

7 years ago

#1 @swissspidy
7 years ago

  • Keywords has-patch has-unit-tests added

#2 @desrosj
5 years ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to Future Release
Note: See TracTickets for help on using tickets.