Author: as
Date: Fri Jul 27 13:18:58 2007
New Revision: 5748

Log:
- Fixed issue #11174: ezcMailHeaderFolder::foldAny doesn't add a line break in
  front of the header value if it is exactly 76 characters.

Modified:
    trunk/Mail/ChangeLog
    trunk/Mail/src/internal/header_folder.php
    trunk/Mail/tests/mail_test.php

Modified: trunk/Mail/ChangeLog
==============================================================================
--- trunk/Mail/ChangeLog [iso-8859-1] (original)
+++ trunk/Mail/ChangeLog [iso-8859-1] Fri Jul 27 13:18:58 2007
@@ -20,6 +20,8 @@
 
 - Fixed issue #11175: ezcMailTools::composeEmailAddress quotes the name part
   if it contains special characters ( , @ < > : ; ' " ).
+- Fixed issue #11174: ezcMailHeaderFolder::foldAny doesn't add a line break in
+  front of the header value if it is exactly 76 characters.
 
 
 1.3 - Monday 02 July 2007

Modified: trunk/Mail/src/internal/header_folder.php
==============================================================================
--- trunk/Mail/src/internal/header_folder.php [iso-8859-1] (original)
+++ trunk/Mail/src/internal/header_folder.php [iso-8859-1] Fri Jul 27 13:18:58 
2007
@@ -87,7 +87,7 @@
     static public function foldAny( $text )
     {
         // Don't fold unless we have to.
-        if ( strlen( $text ) < self::$limit )
+        if ( strlen( $text ) <= self::$limit )
         {
             return $text;
         }

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] Fri Jul 27 13:18:58 2007
@@ -340,6 +340,24 @@
         $this->mail->messageID = "<[EMAIL PROTECTED]>";
         $this->mail->generateHeaders();
         $this->assertEquals( '<[EMAIL PROTECTED]>', $this->mail->getHeader( 
'Message-Id' ) );
+    }
+
+    // test for issue #11174
+    public function testMailHeaderFolding76Char()
+    {
+        $mail = new ezcMail();
+        $mail->from = new ezcMailAddress( '[EMAIL PROTECTED]', 'John Doe' );
+        $mail->addTo( new ezcMailAddress( '[EMAIL PROTECTED]', 'John Doe' ) );
+        $mail->body = new ezcMailText( 'Text' );
+
+        // test some subject sizes
+        for ( $i = 1; $i < 300; $i++ )
+        {
+            $mail->subject = str_repeat( '1', $i );
+            $source = $mail->generate();
+            preg_match( '/Subject:\s[0-9]+/', $source, $matches );
+            $this->assertEquals( 1, count( $matches ), "Subject is folded 
incorrectly for length {$i}." );
+        }
     }
 
     public function testMailAddressToString()


-- 
svn-components mailing list
[EMAIL PROTECTED]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to