Bug #50431 [Com]: Using filter_var to filter an email address returns incorrect result

From: Date: Fri, 20 Aug 2010 14:53:27 +0000
Subject: Bug #50431 [Com]: Using filter_var to filter an email address returns incorrect result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153654@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=50431&edit=1

 ID:                 50431
 Comment by:         michael at squiloople dot com
 Reported by:        troy at scriptedmotion dot com
 Summary:            Using filter_var to filter an email address returns
                     incorrect result
 Status:             Bogus
 Type:               Bug
 Package:            Filter related
 Operating System:   Ubuntu
 PHP Version:        5.2.11
 Block user comment: N

 New Comment:

The standards are actually RFC 5321 and 5322, and according to RFC 5321
(which 
goes into more specific detail over domain names in email addresses),
"in the case 
of a top-level domain used by itself in an email address, a single
string is used 
without any dots."


Previous Comments:
------------------------------------------------------------------------
[2010-05-08 02:32:01] office at lucian0308 dot com

i see a deference 
the standard is http://tools.ietf.org/html/rfc2822

this function respect the standard?

because PEAR
http://pear.php.net/manual/en/package.validate.validate.email.php
say that use RFC2822 and it works corectly 

without  dot and level domain shoud be a false email.

------------------------------------------------------------------------
[2009-12-09 19:02:01] rasmus@php.net

That's a valid email address.  Email addresses don't need a tld.  Try 
emailing root@localhost, for example.  Any locally defined host can 
potentially receive email.

------------------------------------------------------------------------
[2009-12-09 18:59:19] troy at scriptedmotion dot com

Description:
------------
Using filter_var to filter a string containing an email address with no
top level domain returns the string instead of false.

For example:

filter_var('t@1', FILTER_VALIDATE_EMAIL);

returns 't@1' instead of false.

Reproduce code:
---------------
filter_var('t@1', FILTER_VALIDATE_EMAIL); // returns 't@1' instead of
false.

Expected result:
----------------
false

Actual result:
--------------
"t@1" // a string


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50431&edit=1


Thread (7 messages)

« previous php.bugs (#153654) next »