[wp-trac] [WordPress Trac] #30753: wp_parse_str() improperly casts boolean querystring values as strings
WordPress Trac
noreply at wordpress.org
Wed Dec 17 22:03:10 UTC 2014
#30753: wp_parse_str() improperly casts boolean querystring values as strings
--------------------------+-----------------------------
Reporter: r-a-y | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
If you use a querystring in `wp_parse_args()`, `wp_parse_str()` is used.
Let's say we do something like this:
`$r = wp_parse_args(
'this_should_be_bool_false=false&this_should_be_bool_true=true', array()
);`
`$r['this_should_be_bool_false']` equals the string `'false'` instead of
boolean false.
Attached patch uses `wp_validate_boolean()` to properly cast string values
of `'true'` or `'false'` to their boolean equivalents and includes a unit
test.
This may be a wontfix since it's more of a PHP issue with `parse_str()`,
but I thought I'd post this anyway.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30753>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list