[wp-trac] [WordPress Trac] #39428: Die fast in get_posts if get_user_by returns false
WordPress Trac
noreply at wordpress.org
Fri Dec 30 14:35:07 UTC 2016
#39428: Die fast in get_posts if get_user_by returns false
--------------------------+-----------------------------
Reporter: david.binda | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 4.7
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
query.php#L2126
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39428>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list