Skip to content

Commit

Permalink
[ZF-9505]Zend_Mail_Protocol_Abstract - truncates server response when…
Browse files Browse the repository at this point in the history
… SMTP server responds with a message containing spaces

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21634 44c647ce-9c0f-0410-b52a-842ac1e357ba
  • Loading branch information
[email protected] committed Mar 24, 2010
1 parent 233c8b4 commit fe2cbe5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions library/Zend/Mail/Protocol/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ abstract class Zend_Mail_Protocol_Abstract
/**
* String template for parsing server responses using sscanf (default: 3 digit code and response string)
* @var resource
* @deprecated Since 1.10.3
*/
protected $_template = '%d%s';

Expand Down Expand Up @@ -378,8 +379,9 @@ protected function _receive($timeout = null)
protected function _expect($code, $timeout = null)
{
$this->_response = array();
$cmd = '';
$msg = '';
$cmd = '';
$more = '';
$msg = '';
$errMsg = '';

if (!is_array($code)) {
Expand All @@ -388,15 +390,15 @@ protected function _expect($code, $timeout = null)

do {
$this->_response[] = $result = $this->_receive($timeout);
sscanf($result, $this->_template, $cmd, $msg);
list($cmd, $more, $msg) = preg_split('/([\s-]+)/', $result, 2, PREG_SPLIT_DELIM_CAPTURE);

if ($errMsg !== '') {
$errMsg .= $msg;
$errMsg .= ' ' . $msg;
} elseif ($cmd === null || !in_array($cmd, $code)) {
$errMsg = $msg;
}

} while (strpos($msg, '-') === 0); // The '-' message prefix indicates an information string instead of a response string.
} while (strpos($more, '-') === 0); // The '-' message prefix indicates an information string instead of a response string.

if ($errMsg !== '') {
/**
Expand Down

0 comments on commit fe2cbe5

Please sign in to comment.