Skip to content
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

关于验证器的一点建议 #3

Closed
CyberLife-Markus opened this issue Aug 15, 2018 · 2 comments
Closed

关于验证器的一点建议 #3

CyberLife-Markus opened this issue Aug 15, 2018 · 2 comments

Comments

@CyberLife-Markus
Copy link

前提:并不是在TP框架里使用该扩展...
1.在配置里是否应该应该增加抛出异常的配置,目前check后只返回bool,每次判断都需要if判断一下,没办法直接捕获异常输出信息。
if ($check !== true){ return json_encode(['code'=>0,'msg'=>$validate->getError()]); }
2.在实际使用中,发现更希望验证器去完成[数据格式化]的工作,当客户端传递[a,b,c]三个参数进来之后,丢进验证器进行对应的场景验证后,实际业务只需要[a,c]两个参数,所以希望验证器经过场景验证后返回的数据应该是['status'=>true,'data'=>[a,c]],而不是只返回一个bool来判断,把$_POST再放到控制器或者model里边去筛选剔除不需要或者会导致异常的额外参数。

@liu21st
Copy link
Member

liu21st commented Aug 16, 2018

后续版本考虑改进下 但验证操作本身不适合涉及修改操作 这个之前也讨论过很多此 极容易混淆,数据不知不觉的修改却不知道哪里改的

@CyberLife-Markus
Copy link
Author

嗯嗯,也许在Request类里做这个事会清晰些。感谢回复

wandoubaba added a commit to wandoubaba/think-validate that referenced this issue Dec 1, 2023
wandoubaba added a commit to wandoubaba/think-validate that referenced this issue Dec 1, 2023
fix: filter_var(): Argument top-think#3 ($options) must be of type array|int, …
jiangjiangdev added a commit to jiangjiangdev/think-validate that referenced this issue Mar 5, 2024
fix bug of :
Argument top-think#3 ($options) must be of type array|int
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

2 participants