#30238 closed enhancement (fixed)
Treat 'FALSE' as false in wp_validate_boolean()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 4.0 |
Component: | General | Keywords: | has-patch needs-unit-tests |
Focuses: | Cc: |
Description
Attachments (3)
Change History (10)
#2
@
10 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
@
10 years ago
30238.2-tests.diff adds unit tests as well.
Note: See
TracTickets for help on using
tickets.
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 ) ) {