swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

Bug, because (bool) 'false' === true #1274

Closed lifinsky closed 4 years ago

lifinsky commented 4 years ago

https://github.com/swoft-cloud/swoft-component/blob/cfc09277304b45058fe14530daa9cb0722619a80/src/validator/src/Rule/IsBoolRule.php#L46

if (is_bool($value)) {
    $data[$propertyName] = $value;
    return $data;
}
if ($value === 'true') {
    $data[$propertyName] = true;
    return $data;
}
if ($value === 'false') {
    $data[$propertyName] = false;
    return $data;
}
JasonYHZ commented 4 years ago

Thanks, we have fixed