mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-05 05:07:58 +08:00
parent
138bfa9325
commit
77e7789be3
@ -30,6 +30,7 @@ use Hyperf\Validation\ValidationData;
|
||||
use InvalidArgumentException;
|
||||
use SplFileInfo;
|
||||
use Throwable;
|
||||
use function DI\string;
|
||||
|
||||
trait ValidatesAttributes
|
||||
{
|
||||
@ -1492,7 +1493,7 @@ trait ValidatesAttributes
|
||||
return $value->getSize() / 1024;
|
||||
}
|
||||
|
||||
return mb_strlen($value);
|
||||
return mb_strlen((string)$value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1505,6 +1505,12 @@ class ValidationValidatorTest extends TestCase
|
||||
$v = new Validator($trans, ['foo' => '3'], ['foo' => 'Numeric|Size:3']);
|
||||
$this->assertTrue($v->passes());
|
||||
|
||||
$v = new Validator($trans, ['foo' => 123], ['foo' => 'Size:123']);
|
||||
$this->assertFalse($v->passes());
|
||||
|
||||
$v = new Validator($trans, ['foo' => 3], ['foo' => 'Size:1']);
|
||||
$this->assertTrue($v->passes());
|
||||
|
||||
$v = new Validator($trans, ['foo' => [1, 2, 3]], ['foo' => 'Array|Size:3']);
|
||||
$this->assertTrue($v->passes());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user