Doc #71282 [NEW]: Documentation is invalid for FILTER_VALIDATE_EMAIL
From: sebastian dot piskorski at gmail dot com
Operating system: Xubuntu
PHP version: 5.6.16
Package: *General Issues
Bug Type: Documentation Problem
Bug description:Documentation is invalid for FILTER_VALIDATE_EMAIL
Description:
------------
Documatation states that e-mail address validated "against the syntax in
RFC 822, with the exceptions that comments and whitespace folding are
not supported.", which is not true.
Filter validates only against addr-spec specification part. Because such
address is invalid "Test Example <test@example.com>". Another example is
"test@localhost" which should be valid, brcause RFC 822 doesn't fore
address to have a .domain part.
All exceptions should be mentioned, not only current two.
Test script:
---------------
<?php
$emails = array(
'Test Example <test@example.com>',
'test@localhost',
'test@localhost.com'
);
foreach ($emails as $email) {
echo (filter_var($email, FILTER_VALIDATE_EMAIL)) ?
"[+] Email '$email' is valid\n" :
"[-] Email '$email' is NOT valid\n";
}
Expected result:
----------------
[+] Email 'Test Example <test@example.com>' is valid
[+] Email 'test@localhost' is valid
[+] Email 'test@localhost.com' is valid
Actual result:
--------------
[-] Email 'Test Example <test@example.com>' is NOT valid
[-] Email 'test@localhost' is NOT valid
[+] Email 'test@localhost.com' is valid
--
Edit bug report at https://bugs.php.net/bug.php?id=71282&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71282&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71282&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71282&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71282&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71282&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71282&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71282&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71282&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71282&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71282&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71282&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71282&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71282&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71282&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71282&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71282&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71282&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71282&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71282&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71282&r=mysqlcfg
Thread (2 messages)
- sebastian dot piskorski at gmail dot com