PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail » Bug #849

RFC822.php doesn't generate error for malformed addresses

Details

Submitted2004-02-24 17:03 UTC
Fromn dot dose at leo-media dot de
Assignedchagenbu
StatusClosed
PackageMail
PHP Version4.2.2
OSSusE Linux
Roadmaps(Not assigned)

Comments

[2004-02-24 17:03 UTC] n dot dose at leo-media dot de

Description:
------------
(Revision 1.1.0)

This doesn't seem to work on single addresses that are badly formed.

I did some lame debugging by changing the source code with a few echo statements to tell which function we're in and what its args are. Output below.

The problem seems to be on line 475 (in _validateAddress()):
array_walk($addresses, array($this, 'validateMailbox'));

I've never seen array_walk() used like this. Maybe call_user_func_array() was meant, or maybe this is a sneaky way to call object methods.

But validateMailbox() is indeed called. However when it returns false, nothing is done with this information. Execution proceeds to the end of the method: a structure object is returned, just as it is when validateMailbox() doesn't detect any errors and returns something other than false.

In the stuff I included here, 'mai %lu$sa.com' as a domain name is an invalid domain. validateDomain() recognizes this, but execution goes on without raising an error.

'aaa ss' is also dubious as a local part, but that's not my main point.

Reproduce code:
---------------
$emailToTest='aaa ss@mai %lu$sa.com';

Expected result:
----------------
validateAddress(aaa ss@mai %lu$sa.com)
validateMailbox(aaa ss@mai %lu$sa.com)
validateAddrSpec(aaa ss@mai %lu$sa.com)
validateLocalPart(aaa ss)
local part OK
validateDomain(mai %lu$sa.com)
validateAddrSpec()===false
after array_walk()
exiting validateAddress(), raising error
returned to parseAddressList(), raising error.

Actual result:
--------------
validateAddress(aaa ss@mai %lu$sa.com)
validateMailbox(aaa ss@mai %lu$sa.com)
validateAddrSpec(aaa ss@mai %lu$sa.com)
validateLocalPart(aaa ss)
local part OK
validateDomain(mai %lu$sa.com)
validateAddrSpec()===false
after array_walk()
exiting validateAddress(), everything OK
returned to parseAddressList(), no error raised.

[2004-02-25 20:30 UTC] chagenbu at php dot net

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.