PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Validate » Validate » Bug #8629

eMail validation fails

Details

Submitted2006-09-04 10:31 UTC
Fromg dot schuster at laxit dot com
Assignedamir
StatusClosed
PackageValidate
PHP VersionIrrelevant
OSirrelevant
Roadmaps0.8.0

Comments

[2006-09-04 10:31 UTC] g dot schuster at laxit dot com

Description:
------------
eMail validation in package Validate, function email() fails with numbers at start of hostname.

Test script:
---------------
$result = email('test@123host.tld');

Expected result:
----------------
Should return TRUE due to valid email address provided in the example

Actual result:
--------------
Returns FALSE due to false regular expression.

Original regular expression:
((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?) #6 domain as hostname

Working regular expression:
((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z0-9](?:[-a-z0-9]*[a-z0-9])?) #6 domain as hostname

[2006-09-04 16:25 UTC] amir at php dot net

Use 'rfc822 restricted' mode.

[2006-09-05 08:14 UTC] g dot schuster at laxit dot com

Sorry, that's a workaround, no solution.
Even the simple email() function should recognize absolutely correct formed email addresses and hostnames.
I think this should be fixed in the next release of Validate.

[2006-09-20 17:48 UTC] amir at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Hostnames starting with numbers are known valid now.

[2006-09-21 07:42 UTC] g dot schuster at laxit dot com

Thank you so far :)