[wp-trac] [WordPress Trac] #28170: Add utility method for casting a var to boolean
WordPress Trac
noreply at wordpress.org
Thu May 22 18:33:35 UTC 2014
#28170: Add utility method for casting a var to boolean
----------------------------+-----------------------------
Reporter: wonderboymusic | Owner: wonderboymusic
Type: enhancement | Status: closed
Priority: normal | Milestone: 4.0
Component: General | Version: trunk
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses:
----------------------------+-----------------------------
Changes (by wonderboymusic):
* owner: => wonderboymusic
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"28542"]:
{{{
#!CommitTicketReference repository="" revision="28542"
Because PHP can be configured without `--filter`, it is not 100% safe to
use `filter_var()`. This is problematic for casting `"false"` to `false`,
as PHP always casts it to `true`. `FILTER_VALIDATE_BOOLEAN` fixes this,
but it may not be available.
Add a new function, `wp_validate_boolean()`, to replace `filter_var( $var,
FILTER_VALIDATE_BOOLEAN )`.
Fixes #28170.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28170#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list