Fixes #16903: Fixed 'yii\validators\NumberValidator' method 'isNotNumber' returns false for true/false value

This commit is contained in:
Anna Borzenko
2018-11-23 11:55:07 +02:00
committed by Alexander Makarov
parent 3907895324
commit d7ffda020b
3 changed files with 8 additions and 2 deletions

View File

@@ -124,8 +124,9 @@ class NumberValidator extends Validator
private function isNotNumber($value)
{
return is_array($value)
|| (is_object($value) && !method_exists($value, '__toString'))
|| (!is_object($value) && !is_scalar($value) && $value !== null);
|| is_bool($value)
|| (is_object($value) && !method_exists($value, '__toString'))
|| (!is_object($value) && !is_scalar($value) && $value !== null);
}
/**