Issues

ZF-9505: Zend_Mail_Protocol_Abstract - truncates server response when SMTP server responds with a message containing spaces

Issue Type: Bug Created: 2010-03-22T05:17:20.000+0000 Last Updated: 2010-04-13T06:33:34.000+0000 Status: Resolved Fix version(s): - 1.10.3 (01/Apr/10)

Reporter: Alex (lexor) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail

Related issues: - ZF-9299

Attachments:

Description

When server response message contains spaces only the first "word" is retrieved.

Sample response to reproduce: 535 5.7.0 authentication failed

Expected error message: 5.7.0 authentication failed Actual error message: 5.7.0

The reason is using of string template for parsing server responses using sscanf (default: 3 digit code and response string) - '%d%s'. So, the function parses the response until the first space character is encountered.

Comments

Posted by Satoru Yoshida (satoruyoshida) on 2010-03-24T08:25:55.000+0000

Thank You for report, solved SVN r21634.

Posted by Jeff Clark (h0tw1r3) on 2010-04-12T12:06:43.000+0000

Perhaps this deprecation is unnecessary. Wouldn't the follow work just as well?

--- Mail/Protocol/Abstract.php (revision 21842) +++ Mail/Protocol/Abstract.php (working copy) @@ -107,7 +107,7 @@ * String template for parsing server responses using sscanf (default: 3 digit code and response string) * @var resource */ - protected $_template = '%d%s'; + protected $_template = '%d %[^$]s';

 /**

Posted by Alex (lexor) on 2010-04-12T23:12:44.000+0000

2 Jeff Clark Using '%d %[^$]s' doesn't cover cases when response contains hyphen after code (e.g 220-OK) used for multi-line responses.

Posted by Satoru Yoshida (satoruyoshida) on 2010-04-13T06:33:34.000+0000

Thank You, Jeff and Alex.

Zend_Mail_Protocol_Abstract should be able to handle multi-line SMTP response like as specified in ZF-8511.

So, The change of SVN r21634 would be better rather than modifing only $_template.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts