FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=16109&edit=1

ID: 16109
Updated by: daniel.oconnor@gmail.com
Reported By: chabrol at vfnm dot de
Summary: email validates with one trailing newline character
Status: Open
Type: Bug
Package: Validate
Operating System: Linux Fedora 10
Package Version: 0.8.2
PHP Version: 5.2.5
Roadmap Versions:
New Comment:

What would RFC whatever it is do?


Previous Comments:
------------------------------------------------------------------------

[2009-04-16 16:20:32] vfnm

Description:
------------
email adresses with a trailing newline-character are validated
successfully

Test script:
---------------
require_once('Validate.php');
$mail="test@test.de\n";
if (Validate::email($mail) === true) {
echo 'OK';
} else {
echo 'bad';
}

Expected result:
----------------
bad

Actual result:
--------------
OK

------------------------------------------------------------------------

Search Discussions

  • Daniel Oconnor at May 23, 2009 at 5:34 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16109&edit=1

    ID: 16109
    Updated by: daniel.oconnor@gmail.com
    Reported By: chabrol at vfnm dot de
    Summary: email validates with one trailing newline character
    -Status: Open
    +Status: Bogus
    Type: Bug
    Package: Validate
    Operating System: Linux Fedora 10
    Package Version: 0.8.2
    PHP Version: 5.2.5
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Bogus

    RFC 2822 sez:

    " Semantically, neither the optional CFWS outside of the quote
    characters nor the quote characters themselves are part of the
    quoted-string; the quoted-string is what is contained between the
    two
    quote characters. As stated earlier, the "\" in any quoted-pair
    and
    the CRLF in any FWS/CFWS that appears within the quoted-string are
    semantically "invisible" and therefore not part of the
    quoted-string
    either."

    (basically, ignore new lines in bits marked with either FWS or CFWS)


    and

    http://tools.ietf.org/html/rfc2822#section-3.4.1

    addr-spec = local-part "@" domain
    local-part = dot-atom / quoted-string / obs-local-part
    domain = dot-atom / domain-literal / obs-domain
    domain-literal = [CFWS] "[" *([FWS] dcontent) [FWS] "]" [CFWS]

    So basically... you *can* have a \n on the end.


    I'd trim() if I were you


    Previous Comments:
    ------------------------------------------------------------------------

    [2009-05-23 19:29:41] doconnor

    What would RFC whatever it is do?

    ------------------------------------------------------------------------

    [2009-04-16 16:20:32] vfnm

    Description:
    ------------
    email adresses with a trailing newline-character are validated
    successfully

    Test script:
    ---------------
    require_once('Validate.php');
    $mail="test@test.de\n";
    if (Validate::email($mail) === true) {
    echo 'OK';
    } else {
    echo 'bad';
    }

    Expected result:
    ----------------
    bad

    Actual result:
    --------------
    OK

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedMay 23, '09 at 5:30p
activeMay 23, '09 at 5:34p
posts2
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 2 posts

People

Translate

site design / logo © 2022 Grokbase