Mail_RFC822 issue

From: Date: Thu, 27 Feb 2003 01:35:06 +0000
Subject: Mail_RFC822 issue
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13955@lists.php.net to get a copy of this message
Howdy, I am playing around with the validation in Mail_RFC822, and it seems to work well, except a few items. I am using Mail_RFC822 version 1.6 with php 4.3.0. I have some code that uses it to validate emails: <?php //includes and various other stuff here // $v = new Mail_RFC822($email,NULL, FALSE); $ret = $v->parseAddressList(); var_dump( $ret ); ?> I try and validate an address like foo@foo@bar.com and $ret returns something odd. array(1) { [0]=> string(15) "foo@foo@bar.com" } When in fact it should be an error such as when validating foo;foo@bar.com that gives object(pear_error)(7) { ["error_message_prefix"]=> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024) ["code"]=> NULL ["message"]=> string(53) "Invalid address spec. Unmatched quote or bracket ([])" ["userinfo"]=> NULL ["callback"]=> NULL } A successfull validation for foo@bar.com returns something like array(1) { [0]=> object(stdClass)(4) { ["personal"]=> string(0) "" ["comment"]=> array(0) { } ["mailbox"]=> string(3) "foo" ["host"]=> string(7) "bar.com" } } This seems broken to me. foo@foo@bar.com is invalid and should return me a pear_error object. Also I believe that a foo@bar.com should be invalid as well according to RFC 822, since a foo is an atom because it is not wrapped inside " as in "a foo"@bar.com foo:bar@blah.com works, as it should since it is a 'group', but foo:bar:blah@blah.net fails and gives me the same 'error' as foo@foo@bar.com, which is array(1) { [0]=> string(17) "bar:blah@blah.net" } That should also be a pear_error object. Also notice that foo: got chopped

« previous php.pear.dev (#13955) next »