From 7a8c24302fa899be8488e2db6d7df3534f8c6e37 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Sep 2012 09:52:52 +0200 Subject: [PATCH 1/2] Fixed bug #63126, imap_open: DISABLE_AUTHENTICATOR ignores array --- ext/imap/php_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 802bb5164383a..d81a7548555d8 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1191,7 +1191,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (zend_hash_index_find(Z_ARRVAL_PP(disabled_auth_method), i, (void **) &z_auth_method) == SUCCESS) { if (Z_TYPE_PP(z_auth_method) == IS_STRING) { if (Z_STRLEN_PP(z_auth_method) > 1) { - mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(disabled_auth_method)); + mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(z_auth_method)); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); From dc9e35b87e21c0d151fb485b0632e9401c510582 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Sep 2012 18:10:45 +0200 Subject: [PATCH 2/2] add test unit for bug 63126 --- ext/imap/tests/bug63126.phpt | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 ext/imap/tests/bug63126.phpt diff --git a/ext/imap/tests/bug63126.phpt b/ext/imap/tests/bug63126.phpt new file mode 100644 index 0000000000000..70fba3843e615 --- /dev/null +++ b/ext/imap/tests/bug63126.phpt @@ -0,0 +1,52 @@ +--TEST-- +imap_open() DISABLE_AUTHENTICATOR ignores array param +--SKIPIF-- + +--FILE-- + array('DISABLE_AUTHENTICATOR' => array('GSSAPI','NTLM')), + 'String' => array('DISABLE_AUTHENTICATOR' => 'GSSAPI'), +); +require_once(dirname(__FILE__).'/imap_include.inc'); +foreach ($tests as $name => $testparams) { + echo "Test for $name\n"; + $in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1, $testparams); + if ($in) { + if (is_array($errors = imap_errors())) { + foreach ($errors as $err) { + if (strstr($err, 'GSSAPI') || strstr($err, 'Kerberos')) { + echo "$err\n"; + } + } + } + } else { + echo "Can't connect\n"; + } +} +echo "Done\n"; +?> +--EXPECTF-- +Test for Array +Test for String +Done