[wp-trac] [WordPress Trac] #53177: WP_User_Query does not accept fields as string except ID

WordPress Trac noreply at wordpress.org
Mon May 2 00:12:04 UTC 2022

#53177: WP_User_Query does not accept fields as string except ID
 Reporter:  rilwis                               |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.0
Component:  Users                                |     Version:  4.4
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-testing-info has-dev-note has-   |     Focuses:  docs
  patch has-unit-tests needs-docs                |
Changes (by peterwilsoncc):

 * status:  reopened => closed
 * resolution:   => fixed


 In [changeset:"53327" 53327]:
 #!CommitTicketReference repository="" revision="53327"
 Users: Validate `WP_User_Query`'s `fields` argument.

 Improve validation of `WP_User_Query`'s `fields` argument when passed as
 an array to ensure it only accepts permitted values. This prevents the
 invalid values being included in the generated database query.

 Expand unit tests to include passing invalid values as part of an array,
 the lower case value `id`. Correct earlier unit tests to limit database
 query to one result.

 Follow up to [53255].

 Props felipeelia.
 Fixes #53177.

Ticket URL: <https://core.trac.wordpress.org/ticket/53177#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list