]> granicus.if.org Git - php/commitdiff
- Fixed #44098, imap_utf8() returns only capital letters
authorPierre Joye <pajoye@php.net>
Sun, 7 Feb 2010 13:06:54 +0000 (13:06 +0000)
committerPierre Joye <pajoye@php.net>
Sun, 7 Feb 2010 13:06:54 +0000 (13:06 +0000)
ext/imap/config.m4
ext/imap/config.w32
ext/imap/php_imap.c
ext/imap/tests/bug44098.phpt [new file with mode: 0644]

index 4ec798cee7bb1b465fd2cad5ce35c848306d9f55..3ad7c107ddac1e489d64edf7221cd79ae045d42d 100644 (file)
@@ -147,24 +147,24 @@ if test "$PHP_IMAP" != "no"; then
 
     old_CFLAGS=$CFLAGS
     CFLAGS="-I$IMAP_INC_DIR"
-    AC_CACHE_CHECK(for U8T_CANONICAL, ac_cv_u8t_canonical,
+    AC_CACHE_CHECK(for U8T_DECOMPOSE, ac_cv_u8t_canonical,
       AC_TRY_COMPILE([
 #include <c-client.h>
       ],[
          int i = U8T_CANONICAL;
       ],[
-         ac_cv_u8t_canonical=yes
+         ac_cv_u8t_decompose=yes
       ],[
-         ac_cv_u8t_canonical=no
+         ac_cv_u8t_decompose=no
       ])
     )
     CFLAGS=$old_CFLAGS
 
-    if test "$ac_cv_u8t_canonical" = "no" && test "$ac_cv_utf8_mime2text" = "new"; then
-               AC_MSG_ERROR([utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. You may not have c-client installed properly. Check config.log for additional information.])
+    if test "$ac_cv_u8t_decompose" = "no" && test "$ac_cv_utf8_mime2text" = "new"; then
+               AC_MSG_ERROR([utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.])
     fi
-    if test "$ac_cv_u8t_canonical" = "yes" && test "$ac_cv_utf8_mime2text" = "old"; then
-               AC_MSG_ERROR([utf8_mime2text() has old signature, but U8T_CANONICAL is present. This should not happen. You may not have c-client installed properly. Check config.log for additional information.])
+    if test "$ac_cv_u8t_decompose" = "yes" && test "$ac_cv_utf8_mime2text" = "old"; then
+               AC_MSG_ERROR([utf8_mime2text() has old signature, but U8T_CANONICAL is present. This should not happen. Check config.log for additional information.])
     fi
 
     dnl Check for c-client version 2001
index beb12f03e854f2003e8931364cec973b56eedd64..5778c34bb4937d9e98bd4c5d9fc7bb673fec2a86 100644 (file)
@@ -21,6 +21,7 @@ if (PHP_IMAP == "yes") {
                AC_DEFINE('HAVE_NEW_MIME2TEXT', 1, 'Have utf8_mime2text', true);
                AC_DEFINE('HAVE_RFC822_OUTPUT_ADDRESS_LIST', 1, 'Have rfc822_output_address_list', true);
                AC_DEFINE('HAVE_IMAP_MUTF7', 1, 'Have modified utf7 support', true);
+               AC_DEFINE('HAVE_NEW_MIME2TEXT', 1, 'Whether utf8_mime2text() has new signature');
        } else {
                WARNING("imap not enabled; libraries and headers not found");
        }
index 84f445d917f09849fc8dea2f2c933abc544a6283..f0edddf36b9d51336f7a3c3f0b6aa18722249168 100644 (file)
@@ -1169,6 +1169,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
 
        if (params) {
                zval **disabled_auth_method;
+
                if (zend_hash_find(HASH_OF(params), "DISABLE_AUTHENTICATOR", sizeof("DISABLE_AUTHENTICATOR"), (void **)&disabled_auth_method) == SUCCESS) {
                        switch (Z_TYPE_PP(disabled_auth_method)) {
                                case IS_STRING:
@@ -2662,7 +2663,7 @@ PHP_FUNCTION(imap_utf8)
 #ifndef HAVE_NEW_MIME2TEXT
        utf8_mime2text(&src, &dest);
 #else
-       utf8_mime2text(&src, &dest, U8T_CANONICAL);
+       utf8_mime2text(&src, &dest, U8T_DECOMPOSE);
 #endif
        RETVAL_STRINGL(dest.data, dest.size, 1);
        if (dest.data) {
diff --git a/ext/imap/tests/bug44098.phpt b/ext/imap/tests/bug44098.phpt
new file mode 100644 (file)
index 0000000..f758c11
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug #44098 (imap_utf8() returns only capital letters)
+--SKIPIF--
+<?php
+        if (!extension_loaded("imap")) { 
+                die("skip imap extension not available");  
+        }
+?>
+--FILE--
+<?php
+$exp = 'LuzonĀ®14 dot CoM';
+$res = imap_utf8('=?iso-8859-1?b?THV6b26uMTQ=?= dot CoM');
+if ($res != $exp) {
+       echo "failed: got <$res>, expected <exp>\n";
+} else {
+       echo "ok";
+}
+?>
+--EXPECT--
+ok