#28170 closed enhancement (fixed)
Add utility method for casting a var to boolean
| Reported by: | wonderboymusic | Owned by: | wonderboymusic |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.0 |
| Component: | General | Version: | 4.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
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.
Proposed new function: wp_validate_boolean().
Attachments (1)
Change History (4)
This ticket was mentioned in IRC in #wordpress-dev by wonderboymusic. View the logs.
12 years ago
This ticket was mentioned in Slack in #core-restapi by ocean90. View the logs.
10 years ago
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 28542: