Skip to content

Commit 01515d1

Browse files
committed
fix empty string evaluated as false
If FILTER_NULL_ON_FAILURE is set, FALSE is returned for "" from http://php.net/manual/en/filter.filters.validate.php
1 parent 9b5a371 commit 01515d1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Validator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public function isBoolean()
8686
{
8787
return $this->assertCallback(
8888
function ($value) {
89+
if ($value === '') {
90+
return false;
91+
}
92+
8993
return (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== NULL);
9094
},
9195
'is not a boolean'

0 commit comments

Comments
 (0)