[wp-trac] [WordPress Trac] #17737: Be better at forcing data types for query vars

WordPress Trac noreply at wordpress.org
Tue Oct 1 06:56:24 UTC 2019


#17737: Be better at forcing data types for query vars
-------------------------------------+-----------------------------
 Reporter:  juliobox                 |       Owner:  SergeyBiryukov
     Type:  defect (bug)             |      Status:  reviewing
 Priority:  normal                   |   Milestone:  Future Release
Component:  Query                    |     Version:  3.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:
-------------------------------------+-----------------------------

Comment (by tellyworth):

 attachment:17737.6.diff is refreshed for trunk, and incorporates ideas
 from several prior patches. It passes the current unit tests but doesn't
 include new ones.

 A couple of notes:
 * I've used `is_scalar()` and defaulted to `''` or `0` depending on the
 context. That's probably equivalent to prior behaviour but there might be
 subtle edge cases that aren't covered by tests.
 * `cat` and `author` both permit arrays, but they do it in an implicit way
 thanks to `preg_replace()`'s support for arrays in the `subject` param.
 There's test coverage for `cat` (see
 `test_category_querystring_multiple_terms_formatted_as_array`) but not
 `author`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/17737#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list