php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71282 Documentation is invalid for FILTER_VALIDATE_EMAIL
Submitted: 2016-01-05 12:58 UTC Modified: 2018-03-29 17:51 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: sebastian dot piskorski at gmail dot com Assigned:
Status: Closed Package: Filter related
PHP Version: 5.6.16 OS: Xubuntu
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sebastian dot piskorski at gmail dot com
New email:
PHP Version: OS:

 

 [2016-01-05 12:58 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-29 17:51 UTC] cmb@php.net
-Package: *General Issues +Package: Filter related
 [2021-08-05 17:26 UTC] git@php.net
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
 [2021-08-05 17:26 UTC] git@php.net
-Status: Open +Status: Closed
 [2021-08-06 01:24 UTC] git@php.net
Automatic comment on behalf of mumumu
Revision: https://github.com/php/doc-ja/commit/7a9d5ab5fa75da4a92af6afc197833c34899438e
Log: Fix #71282: Documentation is invalid for FILTER_VALIDATE_EMAIL
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC