Skip to content

采用filter_var验证的验证规则bug #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LonelySally opened this issue Apr 27, 2025 · 1 comment
Open

采用filter_var验证的验证规则bug #32

LonelySally opened this issue Apr 27, 2025 · 1 comment

Comments

@LonelySally
Copy link

integer校验规则对1989.9999999999998这样的数字无效,建议改成is_int,同理还有其它filter_var验证的规则都建议改成对应的函数判断

	       'array' => 'is_array',
		'bool' => 'is_bool',
		'boolean' => 'is_bool',
		'float' => 'is_float',
		'int' => 'is_int',
		'integer' => 'is_int',
		'null' => 'is_null',
		'object' => 'is_object',
		'resource' => 'is_resource',
		'scalar' => 'is_scalar',
		'string' => 'is_string',

另外可以增加一个有序数组验证规则,使用array_is_list判断.

@LonelySally
Copy link
Author

date校验有个bug
若给定的入参类型为int时,执行strtotime则会报错strtotime(): Argument #1 ($datetime) must be of type string, int given
在执行strtotime需要对value做(string)$value
Validate.php:1179 'date' => false !== strtotime((string)$value),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant