Home » Validate » Validate » Bug #7176
Validate::email doesn't allow some proper RFC 822 addresses
Details
| Submitted | 2006-03-21 23:58 UTC |
|---|---|
| From | scragz at hotmail dot com |
| Assigned | toggg |
| Status | Closed |
| Package | Validate |
| PHP Version | Irrelevant |
| OS | Debian |
| Roadmaps | (Not assigned) |
Comments
[2006-03-21 23:58 UTC] scragz at hotmail dot com
Description:
------------
These are from the example addresses appendix:
Alfred Neuman <Neuman@BBN-TENEXA>
"George, Ted" <Shared@Group.Arpanet>
Wilt . (the Stilt) Chamberlain@NBA.US
They all fail as of the most recent version. I was previously using addresses like Some User <user@example.com> and they were working. Since I upgraded, these are failing.
Test script:
---------------
if (Validate::email('Alfred Neuman <Neuman@BBN-TENEXA>')) {
echo 'valid';
} else {
echo 'invalid';
}
Expected result:
----------------
valid
Actual result:
--------------
invalid
[2006-03-22 01:38 UTC] scragz at hotmail dot com
This seems to work for that. Probably needs some testing and modifications.
$regex = '/[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+
(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)*\@
[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+
(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)+/i';
(added some newlines so it doesn't kill page layout)