Author: as
Date: Tue Feb 26 15:09:07 2008
New Revision: 7454

Log:
- Fixed issue #12595: Folding is no longer applied twice for To, Cc and Bcc
  headers.
-This line, and those below, will be ignored--

M    src/mail.php
M    tests/mail_test.php
M    ChangeLog

Modified:
    trunk/Mail/ChangeLog
    trunk/Mail/src/mail.php
    trunk/Mail/tests/mail_test.php

Modified: trunk/Mail/ChangeLog
==============================================================================
--- trunk/Mail/ChangeLog [iso-8859-1] (original)
+++ trunk/Mail/ChangeLog [iso-8859-1] Tue Feb 26 15:09:07 2008
@@ -1,3 +1,10 @@
+1.4.3 - [RELEASEDATE]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fixed issue #12595: Folding is no longer applied twice for To, Cc and Bcc
+  headers.
+
+
 1.4.2 - Thursday 17 January 2008
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

Modified: trunk/Mail/src/mail.php
==============================================================================
--- trunk/Mail/src/mail.php [iso-8859-1] (original)
+++ trunk/Mail/src/mail.php [iso-8859-1] Tue Feb 26 15:09:07 2008
@@ -316,18 +316,15 @@
 
         if ( $this->to !== null )
         {
-            $this->setHeader( "To", ezcMailTools::composeEmailAddresses( 
$this->to,
-                                                                         
ezcMailHeaderFolder::getLimit()) );
+            $this->setHeader( "To", ezcMailTools::composeEmailAddresses( 
$this->to ) );
         }
         if ( count( $this->cc ) )
         {
-            $this->setHeader( "Cc", ezcMailTools::composeEmailAddresses( 
$this->cc,
-                                                                         
ezcMailHeaderFolder::getLimit()) );
+            $this->setHeader( "Cc", ezcMailTools::composeEmailAddresses( 
$this->cc ) );
         }
         if ( count( $this->bcc ) )
         {
-            $this->setHeader( "Bcc", ezcMailTools::composeEmailAddresses( 
$this->bcc,
-                                                                          
ezcMailHeaderFolder::getLimit()) );
+            $this->setHeader( "Bcc", ezcMailTools::composeEmailAddresses( 
$this->bcc ) );
         }
 
         $this->setHeader( 'Subject', $this->subject, $this->subjectCharset );

Modified: trunk/Mail/tests/mail_test.php
==============================================================================
--- trunk/Mail/tests/mail_test.php [iso-8859-1] (original)
+++ trunk/Mail/tests/mail_test.php [iso-8859-1] Tue Feb 26 15:09:07 2008
@@ -359,6 +359,33 @@
             preg_match( '/Subject:\s[0-9]+/', $source, $matches );
             $this->assertEquals( 1, count( $matches ), "Subject is folded 
incorrectly for length {$i}." );
         }
+    }
+
+    // test for issue #12595: the Bcc line would have had an empty line 
underneath before the fix
+    // similar for To and Cc headers
+    public function testFoldingAddresses()
+    {
+        $this->mail->from = new ezcMailAddress( '[EMAIL PROTECTED]' );
+        $addresses = array( '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL 
PROTECTED]',
+            '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 
'[EMAIL PROTECTED]' );
+
+        foreach ( $addresses as $address )
+        {
+            $this->mail->addBcc( new ezcMailAddress( $address ) );
+        }
+
+        $expected = "From: [EMAIL PROTECTED]" . ezcMailTools::lineBreak() .
+            "To: " . ezcMailTools::lineBreak() .
+            "Bcc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], 
[EMAIL PROTECTED], [EMAIL PROTECTED]," . ezcMailTools::lineBreak() .
+            " [EMAIL PROTECTED], [EMAIL PROTECTED]" . 
ezcMailTools::lineBreak() .
+            "Subject: " . ezcMailTools::lineBreak() .
+            "MIME-Version: 1.0" . ezcMailTools::lineBreak() .
+            "User-Agent: eZ Components";
+
+        $return = $this->mail->generate();
+        // cut away the Date and Message-ID headers as there is no way to 
predict what they will be
+        $return = join( ezcMailTools::lineBreak(), array_slice( explode( 
ezcMailTools::lineBreak(), $return ), 0, 7 ) );
+        $this->assertEquals( $expected, $return );
     }
 
     public function testMailAddressToString()


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to