PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Validate » Validate » Bug #7176

Validate::email doesn't allow some proper RFC 822 addresses

Details

Submitted2006-03-21 23:58 UTC
Fromscragz at hotmail dot com
Assignedtoggg
StatusClosed
PackageValidate
PHP VersionIrrelevant
OSDebian
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)