Bug #69844 [NEW]: FILTER_VALIDATE_EMAIL rejects unusual but valid addresses
| From: | grzegorz129 at gmail dot com | Date: | Mon, 15 Jun 2015 22:22:54 +0000 |
| Subject: | Bug #69844 [NEW]: FILTER_VALIDATE_EMAIL rejects unusual but valid addresses | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-193528@lists.php.net to get a copy of this message | ||
From: grzegorz129 at gmail dot com
Operating system: Any
PHP version: 7.0.0alpha1
Package: Filter related
Bug Type: Bug
Bug description:FILTER_VALIDATE_EMAIL rejects unusual but valid addresses
Description:
------------
Some weird (but still perfectly valid) e-mail addresses are rejected by
filter_var with FILTER_VALIDATE_EMAIL filter.
I've got sample data from
https://en.wikipedia.org/wiki/Email_address#Valid_email_addresses
While support for comments was mention before I was unable to find any
references to spaces.
Test script:
---------------
$emails = array(
'test@example.com',
'test.derp@example.com',
'test+nick@example.com',
'abc."defghi".xyz@example.com',
'"abcdefghixyz"@example.com',
'jsmith@[192.168.2.1]',
'jsmith@[IPv6:2001:db8::1]',
'long.but.still.perfectly.valid.email.address@on.even.longer.domain.name.owned.by.some.weird.name.company.which.name.you.cannot.pronounce.com',
'other.email-with-dash@example.com',
'"much.more unusual"@example.com',
'"very.unusual.@.unusual.com"@example.com',
'"very.(),:;<>[]\".VERY.\"very@\\
\"very\".unusual"@strange.example.com',
'admin@mailserver1 (local domain name with no TLD)',
'#!$%&\'*+-/=?^_`{}|~@example.org',
'"()<>[]:,;@\\\"!#$%&\'*+-/=?^_`{}| ~.a"@example.org',
'" "@example.org (space between the quotes)',
'âââ@example.com (Unicode characters in local part)',
'âââ@âââ.com (Unicode characters in domain part)',
'new@domain.pizza'
);
foreach ($emails as $email) {
echo (filter_var($email, FILTER_VALIDATE_EMAIL)) ?
"[+] Email $email is valid\n" :
"[-] Email $email is NOT valid\n";
}
Actual result:
--------------
http://3v4l.org/qTsVc
--
Edit bug report at https://bugs.php.net/bug.php?id=69844&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69844&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69844&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69844&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69844&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69844&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69844&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69844&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69844&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69844&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69844&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69844&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69844&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69844&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69844&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69844&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69844&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69844&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69844&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69844&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69844&r=mysqlcfg