summaryrefslogtreecommitdiff
path: root/ext/iconv
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2010-10-21 08:52:46 +0200
committerOndřej Surý <ondrej@sury.org>2010-10-21 08:52:46 +0200
commit01fcdff3849c3691d9aaeaab735846ab6d8895ca (patch)
tree6460876d356113fa7053df36f2aa00baa7db24a9 /ext/iconv
parent855a09f4eded707941180c9d90acd17c25e29447 (diff)
downloadphp-01fcdff3849c3691d9aaeaab735846ab6d8895ca.tar.gz
Imported Upstream version 5.3.3upstream/5.3.3
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/config.w323
-rw-r--r--ext/iconv/iconv.c8
-rw-r--r--ext/iconv/php_iconv.h3
-rw-r--r--ext/iconv/tests/bug48289.phpt22
4 files changed, 30 insertions, 6 deletions
diff --git a/ext/iconv/config.w32 b/ext/iconv/config.w32
index cd800f354..5fe9715b3 100644
--- a/ext/iconv/config.w32
+++ b/ext/iconv/config.w32
@@ -1,4 +1,4 @@
-// $Id: config.w32 262128 2008-07-06 16:59:13Z pajoye $
+// $Id: config.w32 295968 2010-03-08 15:51:08Z kalle $
// vim: ft=javascript
ARG_WITH("iconv", "iconv support", "yes");
@@ -12,6 +12,7 @@ if (PHP_ICONV != "no") {
AC_DEFINE("HAVE_ICONV", 1, "Define if iconv extension is enabled");
AC_DEFINE("HAVE_LIBICONV", 1, "Define if libiconv is available");
+ AC_DEFINE("ICONV_ALIASED_LIBICONV", 1, "The iconv function is called iconv() in libiconv");
AC_DEFINE("PHP_ICONV_IMPL", "\"libiconv\"", "Which iconv implementation to use");
AC_DEFINE("ICONV_SUPPORTS_ERRNO", 1, "Whether iconv supports errno or not");
ADD_FLAG("CFLAGS_ICONV", "/D PHP_ICONV_EXPORTS ");
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 8007fec12..246e1d522 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c 293036 2010-01-03 09:23:27Z sebastian $ */
+/* $Id: iconv.c 298963 2010-05-04 11:56:59Z aharvey $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -182,7 +182,7 @@ static PHP_GINIT_FUNCTION(iconv)
}
/* }}} */
-#ifdef HAVE_LIBICONV
+#if defined(HAVE_LIBICONV) && defined(ICONV_ALIASED_LIBICONV)
#define iconv libiconv
#endif
@@ -1206,7 +1206,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
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;
@@ -1267,7 +1267,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
break;
}
- out_size -= ((nbytes_required - (char_cnt - 2)) + 1) / (3 - 1);
+ out_size -= ((nbytes_required - (char_cnt - 2)) + 1) / 3;
in_left = ini_in_left;
in_p = ini_in_p;
}
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 332ff3357..9ed9b2a3f 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Revision: 293978 $ */
+/* $Revision: 295968 $ */
#ifndef PHP_ICONV_H
#define PHP_ICONV_H
@@ -37,6 +37,7 @@
#ifdef PHP_ATOM_INC
#include "ext/iconv/php_have_iconv.h"
#include "ext/iconv/php_have_libiconv.h"
+#include "ext/iconv/php_iconv_aliased_libiconv.h"
#include "ext/iconv/php_have_glibc_iconv.h"
#include "ext/iconv/php_have_bsd_iconv.h"
#include "ext/iconv/php_have_ibm_iconv.h"
diff --git a/ext/iconv/tests/bug48289.phpt b/ext/iconv/tests/bug48289.phpt
new file mode 100644
index 000000000..fc2cd360b
--- /dev/null
+++ b/ext/iconv/tests/bug48289.phpt
@@ -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?=