cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[BUG][1.3.0] - getPost & get sanitize not work

Open doit76 opened this issue 12 years ago • 6 comments

$_POST['email'] = "not email"; $email = $this->request->getPost('email','email'); echo $email;

result: not email

should false

doit76 avatar Mar 09 '14 20:03 doit76

This not bug. The result same as this:

echo filter_var("not email", FILTER_SANITIZE_EMAIL);

dreamsxin avatar Mar 10 '14 08:03 dreamsxin

i expected VALIDATE not SANITIZE

var_dump(filter_var("not email", FILTER_VALIDATE_EMAIL));

bool(false)

doit76 avatar Mar 10 '14 08:03 doit76

In get* method is sanitize.

dreamsxin avatar Mar 10 '14 09:03 dreamsxin

Is any way to validate than sanitize, because more useful in this case is get false than "notemail" string which is not email?

doit76 avatar Mar 10 '14 09:03 doit76

I checked other case

var_dump($this->request->getPost('email','int'));

string(0) ""

doit76 avatar Mar 10 '14 10:03 doit76

$this->request->getPost('email','email');

This is sanitizing... not validation...

lantian avatar Mar 10 '14 13:03 lantian