Author: Alexandru Stanoi Date: 2007-04-25 16:04:19 +0200 (Wed, 25 Apr 2007) New Revision: 4917
Log: - Fixed issue #8369: Ignoring notices thrown by iconv() in the convertToUTF8() method. Added: trunk/Mail/tests/parser/data/various/test-broken-iconv-1 trunk/Mail/tests/parser/data/various/test-broken-iconv-2 Modified: trunk/Mail/ChangeLog trunk/Mail/src/internal/charset_convert.php trunk/Mail/tests/parser/parser_test.php Modified: trunk/Mail/ChangeLog =================================================================== --- trunk/Mail/ChangeLog 2007-04-24 13:54:16 UTC (rev 4916) +++ trunk/Mail/ChangeLog 2007-04-25 14:04:19 UTC (rev 4917) @@ -58,6 +58,8 @@ ezcMailFileParser. - Fixed issue #10396: Method convertToUTF8 assumes 'latin1' charset instead of 'unknown-8bit' and 'x-user-defined'. +- Fixed issue #8369: Ignoring notices thrown by iconv() in the convertToUTF8() + method. 1.2 - Monday 18 December 2006 Modified: trunk/Mail/src/internal/charset_convert.php =================================================================== --- trunk/Mail/src/internal/charset_convert.php 2007-04-24 13:54:16 UTC (rev 4916) +++ trunk/Mail/src/internal/charset_convert.php 2007-04-25 14:04:19 UTC (rev 4917) @@ -3,8 +3,8 @@ * File containing the ezcMailCharsetConverter * * @package Mail - * @version //autogen// - * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved. + * @version //autogentag// + * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved. * @license http://ez.no/licenses/new_bsd New BSD License * @access private */ @@ -13,7 +13,7 @@ * Small internal class for common character set conversion methods inside Mail. * * @package Mail - * @version //autogen// + * @version //autogentag// * @access private */ class ezcMailCharsetConverter @@ -34,7 +34,7 @@ { $originalCharset = "latin1"; } - return iconv( $originalCharset, 'utf-8', $text ); + return @iconv( $originalCharset, 'utf-8', $text ); } } ?> Added: trunk/Mail/tests/parser/data/various/test-broken-iconv-1 =================================================================== --- trunk/Mail/tests/parser/data/various/test-broken-iconv-1 2007-04-24 13:54:16 UTC (rev 4916) +++ trunk/Mail/tests/parser/data/various/test-broken-iconv-1 2007-04-25 14:04:19 UTC (rev 4917) @@ -0,0 +1,64 @@ +From [EMAIL PROTECTED] Thu Oct 26 09:56:18 2006 +Return-Path: <[EMAIL PROTECTED]> +Received: from kossu.home.example.nl (localhost [127.0.0.1]) + by kossu.home.example.nl (8.13.7/8.13.7/Debian-2) with ESMTP id k9Q7uHWa011688 + for <[EMAIL PROTECTED]>; Thu, 26 Oct 2006 09:56:18 +0200 +X-Spam-Tests: SUB_HELLO,UPPERCASE_25_50 +X-Spam-Score: 1.8 required=8.0 +X-Spam-Flag: NO +X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on example.nl +X-Spam-Level: * +X-Spam-Status: No, score=1.8 required=8.0 tests=SUB_HELLO,UPPERCASE_25_50 + autolearn=disabled version=3.1.4 +X-Spam-Summary: 1.8 SUB_HELLO Subject starts with "Hello" + 0.0 UPPERCASE_25_50 message body is 25-50% uppercase +X-Spam-Report: + * 1.8 SUB_HELLO Subject starts with "Hello" + * 0.0 UPPERCASE_25_50 message body is 25-50% uppercase +Received: from 127.0.0.1 [127.0.0.1] + by kossu.home.example.nl with POP3 (fetchmail-6.3.4) + for <[EMAIL PROTECTED]> (single-drop); Thu, 26 Oct 2006 09:56:18 +0200 (CEST) +Received: from localhost (localhost [127.0.0.1]) + by example.nl (8.13.7/8.12.11) with ESMTP id k9Q7sLUN017048 + for <[EMAIL PROTECTED]>; Thu, 26 Oct 2006 09:54:21 +0200 +X-Virus-Scanned: by amavisd-new at example.nl +Received: from mta.example.no ([85.19.74.75]) + by example.nl (8.13.7/8.12.11) with ESMTP id k9Q7sKpA004605 + for <[EMAIL PROTECTED]>; Thu, 26 Oct 2006 09:54:21 +0200 +Received: from mail.example.fi (posti.example.fi [193.211.31.197]) + by mta.example.no (Postfix) with ESMTP id A207248C037 + for <[EMAIL PROTECTED]>; Thu, 26 Oct 2006 09:54:20 +0200 (CEST) +Received: by mail.example.fi (Postfix, from userid 5000) + id C9C8C16FE3; Thu, 26 Oct 2006 10:54:14 +0300 (EEST) +Received: from localhost.localdomain (unknown [192.168.0.14]) + by mail.example.fi (Postfix) with ESMTP id 80BCF16FE0 + for <[EMAIL PROTECTED]>; Thu, 26 Oct 2006 10:54:14 +0300 (EEST) +Received: by localhost.localdomain (Postfix, from userid 33) + id 2C9E882C79; Thu, 26 Oct 2006 10:54:14 +0300 (EEST) +From: Mikko Koppanen <[EMAIL PROTECTED]> +To: [EMAIL PROTECTED] +Subject: Hello world +Message-Id: <[EMAIL PROTECTED]> +Date: Thu, 26 Oct 2006 10:54:14 +0300 (EEST) +X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-2.1.12 (example.nl [82.94.239.7]); Thu, 26 Oct 2006 09:54:21 +0200 (CEST) +X-Bogosity: Unsure, tests=bogofilter, spamicity=0.500266, version=0.96.0 + + +******************************************************* +TIETOJ�JESTELMIEN TOIMITTAJA -- www.example.fi +YKSI J�JESTELM�TIEDONHALLINTAAN -- www.example.net +******************************************************* + +------ +SENDER +------ +NAME: Mikko Koppanen +COMPANY: Probis Solutions Oy +EMAIL: [EMAIL PROTECTED] +WEB: www.example.fi +ADDRESS: PL 92 + Kilpakorventie 171 + FIN-42101 JAMSA + FINLAND +PHONE: +358-14-748 0400 + Added: trunk/Mail/tests/parser/data/various/test-broken-iconv-2 =================================================================== --- trunk/Mail/tests/parser/data/various/test-broken-iconv-2 2007-04-24 13:54:16 UTC (rev 4916) +++ trunk/Mail/tests/parser/data/various/test-broken-iconv-2 2007-04-25 14:04:19 UTC (rev 4917) @@ -0,0 +1,24 @@ +Return-Path: <> +X-Original-To: [EMAIL PROTECTED] +Delivered-To: [EMAIL PROTECTED] +Received: by mail.example.net (Postfix, from userid 5000) + id 157AF16FE4; Sat, 9 Dec 2006 09:11:56 +0200 (EET) +Received: from mail.example.com (mail.example.com [127.0.0.1]) + by mail.example.net (Postfix) with ESMTP id D56E416FE1 + for <[EMAIL PROTECTED]>; Sat, 9 Dec 2006 09:11:55 +0200 (EET) +Received: from mail.example.com by + with SMTP (Code-Crafters Ability Mail Server 2.57); +Sat, 09 Dec 2006 09:15:36 +0200 +From: <[EMAIL PROTECTED]> +To: "Mikko Koppanen" <[EMAIL PROTECTED]> +Subject: Auto-Response: VACATION +Date: Sat, 09 Dec 2006 09:15:36 +0200 +Message-ID: <[EMAIL PROTECTED]> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +This is an automated response. +Olen ty=F6matkalla 11.-13.12. + Out off Office 11 - 13th of December. Modified: trunk/Mail/tests/parser/parser_test.php =================================================================== --- trunk/Mail/tests/parser/parser_test.php 2007-04-24 13:54:16 UTC (rev 4916) +++ trunk/Mail/tests/parser/parser_test.php 2007-04-25 14:04:19 UTC (rev 4917) @@ -1310,5 +1310,23 @@ $this->assertEquals( 1194, $mail->size ); $this->assertEquals( 1193, strlen( $src ) ); } + + public function testIconvCharsetConverterIconv1() + { + $parser = new ezcMailParser(); + $set = new SingleFileSet( 'various/test-broken-iconv-1' ); + $mail = $parser->parseMail( $set ); + $mail = $mail[0]; + $this->assertEquals( 63, strlen( $mail->body->text ) ); + } + + public function testIconvCharsetConverterIconv2() + { + $parser = new ezcMailParser(); + $set = new SingleFileSet( 'various/test-broken-iconv-2' ); + $mail = $parser->parseMail( $set ); + $mail = $mail[0]; + $this->assertEquals( 38, strlen( $mail->body->text ) ); + } } ?> -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components