svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/iconv/iconv.c branches/PHP_5_2/ext/iconv/tests/bug48289.phpt branches/PHP_5_3/NEWS
branches/PHP_5_3/ext/iconv/iconv.c branches/PHP_5_3/ext/iconv/tests/bug48289.phpt trunk/ext/iconv/iconv.c trunk/ext/iconv/tests/bug48289.phpt
| From: | Adam Harvey | Date: | Tue, 04 May 2010 11:56:59 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/iconv/iconv.c branches/PHP_5_2/ext/iconv/tests/bug48289.phpt branches/PHP_5_3/NEWS branches/PHP_5_3/ext/iconv/iconv.c branches/PHP_5_3/ext/iconv/tests/bug48289.phpt trunk/ext/iconv/iconv.c trunk/ext/iconv/tests/bug48289.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-62540@lists.php.net to get a copy of this message | ||
aharvey Tue, 04 May 2010 11:56:59 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=298963
Log:
Fix for bug #48289 (iconv_mime_encode() quoted-printable scheme is broken).
Thanks to Hiroaki Kawai for the original patch.
Bug: http://bugs.php.net/48289 (Assigned)
iconv_mime_encode() quoted-printable scheme is broken
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/iconv/iconv.c
A php/php-src/branches/PHP_5_2/ext/iconv/tests/bug48289.phpt
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/iconv/iconv.c
A php/php-src/branches/PHP_5_3/ext/iconv/tests/bug48289.phpt
U php/php-src/trunk/ext/iconv/iconv.c
A php/php-src/trunk/ext/iconv/tests/bug48289.phpt
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2010-05-04 11:01:46 UTC (rev 298962)
+++ php/php-src/branches/PHP_5_2/NEWS 2010-05-04 11:56:59 UTC (rev 298963)
@@ -66,6 +66,8 @@
- Fixed bug #49723 (LimitIterator with empty SeekableIterator). (Etienne)
- Fixed bug #49576 (FILTER_VALIDATE_EMAIL filter needs updating) (Rasmus)
- Fixed bug #49267 (Linking fails for iconv). (Moriyosh)
+- Fixed bug #48289 (iconv_mime_encode() quoted-printable scheme is broken).
+ (Adam, patch from hiroaki dot kawai at gmail dot com).
- Fixed bug #43314 (iconv_mime_encode(), broken Q scheme). (Rasmus)
- Fixed bug #23229 (syslog() truncates messages). (Adam)
Modified: php/php-src/branches/PHP_5_2/ext/iconv/iconv.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/iconv/iconv.c 2010-05-04 11:01:46 UTC (rev 298962)
+++ php/php-src/branches/PHP_5_2/ext/iconv/iconv.c 2010-05-04 11:56:59 UTC (rev 298963)
@@ -1217,7 +1217,7 @@
prev_in_left = ini_in_left = in_left;
ini_in_p = in_p;
- for (out_size = char_cnt; out_size > 0;) {
+ for (out_size = (char_cnt - 2) / 3; out_size > 0;) {
size_t prev_out_left;
nbytes_required = 0;
Added: php/php-src/branches/PHP_5_2/ext/iconv/tests/bug48289.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/iconv/tests/bug48289.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/iconv/tests/bug48289.phpt 2010-05-04 11:56:59 UTC (rev 298963)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #48289 (iconv_mime_encode() quoted-printable scheme is broken)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not
available'); ?>
+--FILE--
+<?php
+$text = "\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88";
+$options = array(
+ 'scheme' => 'Q',
+ 'input-charset' => 'UTF-8',
+ 'output-charset' => 'UTF-8',
+ 'line-length' => 30,
+);
+
+echo iconv_mime_encode('Subject', $text, $options);
+--EXPECT--
+Subject: =?UTF-8?Q?=E3=83=86?=
+ =?UTF-8?Q?=E3=82=B9?=
+ =?UTF-8?Q?=E3=83=88?=
+ =?UTF-8?Q?=E3=83=86?=
+ =?UTF-8?Q?=E3=82=B9?=
+ =?UTF-8?Q?=E3=83=88?=
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-05-04 11:01:46 UTC (rev 298962)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-05-04 11:56:59 UTC (rev 298963)
@@ -131,6 +131,8 @@
(yoarvi@gmail.com, Derick)
- Fixed bug #48983 (DomDocument : saveHTMLFile wrong charset). (Rob)
- Fixed bug #48902 (Timezone database fallback map is outdated). (Derick)
+- Fixed bug #48289 (iconv_mime_encode() quoted-printable scheme is broken).
+ (Adam, patch from hiroaki dot kawai at gmail dot com).
- Fixed bug #48781 (Cyclical garbage collector memory leak). (Dmitry)
- Fixed bug #48361 (SplFileInfo::getPathInfo should return the
parent dir). (Etienne)
Modified: php/php-src/branches/PHP_5_3/ext/iconv/iconv.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/iconv/iconv.c 2010-05-04 11:01:46 UTC (rev 298962)
+++ php/php-src/branches/PHP_5_3/ext/iconv/iconv.c 2010-05-04 11:56:59 UTC (rev 298963)
@@ -1206,7 +1206,7 @@
prev_in_left = ini_in_left = in_left;
ini_in_p = in_p;
- for (out_size = char_cnt; out_size > 0;) {
+ for (out_size = (char_cnt - 2) / 3; out_size > 0;) {
size_t prev_out_left;
nbytes_required = 0;
Added: php/php-src/branches/PHP_5_3/ext/iconv/tests/bug48289.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/iconv/tests/bug48289.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/iconv/tests/bug48289.phpt 2010-05-04 11:56:59 UTC (rev 298963)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #48289 (iconv_mime_encode() quoted-printable scheme is broken)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not
available'); ?>
+--FILE--
+<?php
+$text = "\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88";
+$options = array(
+ 'scheme' => 'Q',
+ 'input-charset' => 'UTF-8',
+ 'output-charset' => 'UTF-8',
+ 'line-length' => 30,
+);
+
+echo iconv_mime_encode('Subject', $text, $options);
+--EXPECT--
+Subject: =?UTF-8?Q?=E3=83=86?=
+ =?UTF-8?Q?=E3=82=B9?=
+ =?UTF-8?Q?=E3=83=88?=
+ =?UTF-8?Q?=E3=83=86?=
+ =?UTF-8?Q?=E3=82=B9?=
+ =?UTF-8?Q?=E3=83=88?=
Modified: php/php-src/trunk/ext/iconv/iconv.c
===================================================================
--- php/php-src/trunk/ext/iconv/iconv.c 2010-05-04 11:01:46 UTC (rev 298962)
+++ php/php-src/trunk/ext/iconv/iconv.c 2010-05-04 11:56:59 UTC (rev 298963)
@@ -1206,7 +1206,7 @@
prev_in_left = ini_in_left = in_left;
ini_in_p = in_p;
- for (out_size = char_cnt; out_size > 0;) {
+ for (out_size = (char_cnt - 2) / 3; out_size > 0;) {
size_t prev_out_left;
nbytes_required = 0;
Added: php/php-src/trunk/ext/iconv/tests/bug48289.phpt
===================================================================
--- php/php-src/trunk/ext/iconv/tests/bug48289.phpt (rev 0)
+++ php/php-src/trunk/ext/iconv/tests/bug48289.phpt 2010-05-04 11:56:59 UTC (rev 298963)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #48289 (iconv_mime_encode() quoted-printable scheme is broken)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not
available'); ?>
+--FILE--
+<?php
+$text = "\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88";
+$options = array(
+ 'scheme' => 'Q',
+ 'input-charset' => 'UTF-8',
+ 'output-charset' => 'UTF-8',
+ 'line-length' => 30,
+);
+
+echo iconv_mime_encode('Subject', $text, $options);
+--EXPECT--
+Subject: =?UTF-8?Q?=E3=83=86?=
+ =?UTF-8?Q?=E3=82=B9?=
+ =?UTF-8?Q?=E3=83=88?=
+ =?UTF-8?Q?=E3=83=86?=
+ =?UTF-8?Q?=E3=82=B9?=
+ =?UTF-8?Q?=E3=83=88?=