0

I'm using Polymer's gold-email-input, and I'm surprised it validates an email without an extension as being okay because I've never seen them before. For example "email@email" validates without returning an error. This contradicts PHP's filter_var("email@email", FILTER_VALIDATE_EMAIL) by equaling false. Do email's without extensions really exist?

Chewie The Chorkie
  • 4,896
  • 9
  • 46
  • 90
  • 1
    Sure. It's perfectly valid. Also http://php.net/manual/en/function.filter-var.php#112492 – PeeHaa Oct 26 '15 at 20:55
  • So PHP's email validation function is not entirely accurate? I guess I will have to find another filter function or make one myself. – Chewie The Chorkie Oct 26 '15 at 21:03
  • 1
    Not a single email address validation function/method in any language is entirely accurate. And no don't try to come up with your own validation you will fail. Just use php's validation – PeeHaa Oct 26 '15 at 21:04
  • Use PHP's validation? Isn't Polymer's more accurate since it validates emails without a dot? This also worries me since I would like to use Polymer's live validation, but I also need to validate it with PHP. – Chewie The Chorkie Oct 26 '15 at 21:05
  • You keep talking about polymer, but isn't it just html's standard address validator? – PeeHaa Oct 26 '15 at 21:07
  • I'm not sure, because I have not been able to track down where Polymer's validate and _handleAutoValidate functions come from. Say if it was html's standard address validator, would that make it any worse than PHP's? I'd think it's better because it can check for more possible addresses. – Chewie The Chorkie Oct 26 '15 at 21:14
  • 1
    When looking at the [source for Chrome](https://chromium.googlesource.com/chromium/blink/+/master/Source/core/html/forms/EmailInputType.cpp). It says that [`"email"@example.com` is not valid](http://rubular.com/r/3BIxkuyeOo), but it strictly is a valid address confirming to the spec. While PHP does the correct thing https://3v4l.org/hlI0V. trust me you don't want to get near trying to validate email adresses yourself. Just check for `{something}@{something}.{something}` on the client side (custom pattern) and use PHP's validator on the serverside – PeeHaa Oct 26 '15 at 21:26

0 Answers0