Jelajahi Sumber

[ZF-8511] Zend_Mail_Protocol_Abstract - truncates server response when SMTP server responds with umultiple line error message

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19629 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp 16 tahun lalu
induk
melakukan
81928e2171
1 mengubah file dengan 13 tambahan dan 6 penghapusan
  1. 13 6
      library/Zend/Mail/Protocol/Abstract.php

+ 13 - 6
library/Zend/Mail/Protocol/Abstract.php

@@ -380,6 +380,7 @@ abstract class Zend_Mail_Protocol_Abstract
         $this->_response = array();
         $cmd = '';
         $msg = '';
+        $errMsg = '';
 
         if (!is_array($code)) {
             $code = array($code);
@@ -389,16 +390,22 @@ abstract class Zend_Mail_Protocol_Abstract
             $this->_response[] = $result = $this->_receive($timeout);
             sscanf($result, $this->_template, $cmd, $msg);
 
-            if ($cmd === null || !in_array($cmd, $code)) {
-                /**
-                 * @see Zend_Mail_Protocol_Exception
-                 */
-                require_once 'Zend/Mail/Protocol/Exception.php';
-                throw new Zend_Mail_Protocol_Exception($result);
+            if ($errMsg !== '') {
+                $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.
 
+        if ($errMsg !== '') {
+            /**
+             * @see Zend_Mail_Protocol_Exception
+             */
+            require_once 'Zend/Mail/Protocol/Exception.php';
+            throw new Zend_Mail_Protocol_Exception($errMsg);
+        }
+
         return $msg;
     }
 }