Author: Alexandru Stanoi
Date: 2007-03-01 14:46:37 +0100 (Thu, 01 Mar 2007)
New Revision: 4702

Log:
- Fixed issue #10358: correct call to the ezcMailTextParser constructor in
  case the parsed message contains an unrecognized MIME main type.

Added:
   stable/Mail/1.2/tests/parser/data/various/test-unrecognized-mime
   stable/Mail/1.2/tests/parser/data/various/test-unrecognized-subtype
Modified:
   stable/Mail/1.2/ChangeLog
   stable/Mail/1.2/src/parser/interfaces/part_parser.php
   stable/Mail/1.2/tests/parser/parser_test.php

Modified: stable/Mail/1.2/ChangeLog
===================================================================
--- stable/Mail/1.2/ChangeLog   2007-03-01 13:43:50 UTC (rev 4701)
+++ stable/Mail/1.2/ChangeLog   2007-03-01 13:46:37 UTC (rev 4702)
@@ -14,6 +14,8 @@
   contains the filename encoded with base64 to avoid problems.
 - Fixed issue #10136: ezcMailImapSet, ezcMailPop3Set and ezcMailMboxSet not
   marked as private anymore.
+- Fixed issue #10358: correct call to the ezcMailTextParser constructor in
+  case the parsed message contains an unrecognized MIME main type.
 
 
 1.2 - Monday 18 December 2006

Modified: stable/Mail/1.2/src/parser/interfaces/part_parser.php
===================================================================
--- stable/Mail/1.2/src/parser/interfaces/part_parser.php       2007-03-01 
13:43:50 UTC (rev 4701)
+++ stable/Mail/1.2/src/parser/interfaces/part_parser.php       2007-03-01 
13:46:37 UTC (rev 4702)
@@ -144,7 +144,7 @@
             default:
                 // we treat the body as text if no main content type is set
                 // or if it is unknown
-                $bodyParser = new ezcMailTextParser( $headers );
+                $bodyParser = new ezcMailTextParser( $subType, $headers );
                 break;
         }
         return $bodyParser;

Added: stable/Mail/1.2/tests/parser/data/various/test-unrecognized-mime
===================================================================
--- stable/Mail/1.2/tests/parser/data/various/test-unrecognized-mime    
2007-03-01 13:43:50 UTC (rev 4701)
+++ stable/Mail/1.2/tests/parser/data/various/test-unrecognized-mime    
2007-03-01 13:46:37 UTC (rev 4702)
@@ -0,0 +1,26 @@
+From: Somebody <[EMAIL PROTECTED]>
+To: Another <[EMAIL PROTECTED]>
+Subject: Unknown MIME attached
+MIME-Version: 1.0
+User-Agent: eZ components
+Date: Thu, 01 Mar 2007 14:09:39 +0100
+Message-Id: <[EMAIL PROTECTED]>
+Content-Type: multipart/mixed; boundary="200703011414139:13842:0"
+
+This message is in MIME format. Since your mail reader does not understand
+this format, some or all of this message may not be legible.
+
+--200703011414139:13842:0
+Content-Type: text/plain; charset=us-ascii
+Content-Transfer-Encoding: 8bit
+
+What is the attached MIME?
+--200703011414139:13842:0
+Content-Type: unknown/unknown; name="unknown.dat"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="unknown.dat"
+
+U29tZSBjb250ZW50cw==
+
+--200703011414139:13842:0--
+

Added: stable/Mail/1.2/tests/parser/data/various/test-unrecognized-subtype
===================================================================
--- stable/Mail/1.2/tests/parser/data/various/test-unrecognized-subtype 
2007-03-01 13:43:50 UTC (rev 4701)
+++ stable/Mail/1.2/tests/parser/data/various/test-unrecognized-subtype 
2007-03-01 13:46:37 UTC (rev 4702)
@@ -0,0 +1,26 @@
+From: Somebody <[EMAIL PROTECTED]>
+To: Another <[EMAIL PROTECTED]>
+Subject: Unknown MIME attached
+MIME-Version: 1.0
+User-Agent: eZ components
+Date: Thu, 01 Mar 2007 14:22:34 +0100
+Message-Id: <[EMAIL PROTECTED]>
+Content-Type: multipart/mixed; boundary="200703011414134:13962:0"
+
+This message is in MIME format. Since your mail reader does not understand
+this format, some or all of this message may not be legible.
+
+--200703011414134:13962:0
+Content-Type: text/plain; charset=us-ascii
+Content-Transfer-Encoding: 8bit
+
+What is the attached MIME?
+--200703011414134:13962:0
+Content-Type: message/unrecognized; name="unknown.dat"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="unknown.dat"
+
+U29tZSBjb250ZW50cw==
+
+--200703011414134:13962:0--
+

Modified: stable/Mail/1.2/tests/parser/parser_test.php
===================================================================
--- stable/Mail/1.2/tests/parser/parser_test.php        2007-03-01 13:43:50 UTC 
(rev 4701)
+++ stable/Mail/1.2/tests/parser/parser_test.php        2007-03-01 13:46:37 UTC 
(rev 4702)
@@ -931,5 +931,29 @@
         $filePart = $parts[0];
         $this->assertEquals( null, $filePart->contentDisposition );
     }
+
+    public function testDefaultUnrecognizedMainTypeParserBug()
+    {
+        $parser = new ezcMailParser();
+        $set = new SingleFileSet( 'various/test-unrecognized-mime' );
+        $mail = $parser->parseMail( $set );
+        $mail = $mail[0];
+        $parts = $mail->body->getParts();
+        $this->assertEquals( 'ezcMailText', get_class( $parts[1] ) );
+        $this->assertEquals( 'unknown', $parts[1]->subType );
+        $this->assertEquals( 'unknown/unknown; name="unknown.dat"', 
$parts[1]->getHeader( "Content-Type" ) );
+    }
+
+    public function testDefaultUnrecognizedMessageSubType()
+    {
+        $parser = new ezcMailParser();
+        $set = new SingleFileSet( 'various/test-unrecognized-subtype' );
+        $mail = $parser->parseMail( $set );
+        $mail = $mail[0];
+        $parts = $mail->body->getParts();
+        $this->assertEquals( 'ezcMailText', get_class( $parts[1] ) );
+        $this->assertEquals( 'unrecognized', $parts[1]->subType );
+        $this->assertEquals( 'message/unrecognized; name="unknown.dat"', 
$parts[1]->getHeader( "Content-Type" ) );
+    }
 }
 ?>

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

Reply via email to