Doc #71282 [Opn->Csd]: Documentation is invalid for FILTER_VALIDATE_EMAIL
Edit report at https://bugs.php.net/bug.php?id=71282&edit=1
ID: 71282
Updated by: git@php.net
Reported by: sebastian dot piskorski at gmail dot com
Summary: Documentation is invalid for FILTER_VALIDATE_EMAIL
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Filter related
Operating System: Xubuntu
PHP Version: 5.6.16
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/5be3a93cfde6563c2c2c1ee97be7bd01bed64ee5
Log: Fix #71282: Documentation is invalid for FILTER_VALIDATE_EMAIL
Previous Comments:
------------------------------------------------------------------------
[2016-01-05 12:58:52] sebastian dot piskorski at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=71282&edit=1
Thread (2 messages)