#30238 closed enhancement (fixed)
Treat 'FALSE' as false in wp_validate_boolean()
| Reported by: | TobiasBg | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.1 |
| Component: | General | Version: | 4.0 |
| Severity: | normal | Keywords: | has-patch needs-unit-tests |
| Cc: | Focuses: |
Description
Attachments (3)
Change History (10)
#2
@
12 years ago
Nice catch, kitchin! Thanks!
30238.2.diff is a new patch with an is_string() check. I'd stick with the === check though, as it's cleaner and shows that we know that we are dealing with strings at this point.
#4
@
12 years ago
30238.2-tests.diff adds unit tests as well.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
From the patch:
if ( 'false' === strtolower( $var ) ) {But
strtolower()always returns a string so===is redundant. A non-scalar$var(like an object) might cause an error or warning. So I'd suggest:if ( is_string( $var ) && 'false' == strtolower( $var ) ) {