xref: /PHP-5.3/ext/imap/tests/bug63126.phpt (revision 92147243)
1--TEST--
2imap_open() DISABLE_AUTHENTICATOR ignores array param
3--SKIPIF--
4<?php
5extension_loaded('imap') or die('skip imap extension not available in this build');
6
7require_once(dirname(__FILE__).'/imap_include.inc');
8
9$in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1);
10if (!$in) {
11    die("skip could not connect to mailbox $default_mailbox");
12}
13$kerberos = false;
14if (is_array($errors = imap_errors())) {
15    foreach ($errors as $err) {
16        if (strstr($err, 'GSSAPI') || strstr($err, 'Kerberos')) {
17            $kerberos = true;
18        }
19    }
20}
21if (!$kerberos) {
22    die("skip need a GSSAPI/Kerberos aware server");
23}
24?>
25--FILE--
26<?php
27$tests = array(
28    'Array'  => array('DISABLE_AUTHENTICATOR' => array('GSSAPI','NTLM')),
29    'String' => array('DISABLE_AUTHENTICATOR' => 'GSSAPI'),
30);
31require_once(dirname(__FILE__).'/imap_include.inc');
32foreach ($tests as $name => $testparams) {
33    echo "Test for $name\n";
34    $in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1, $testparams);
35    if ($in) {
36        if (is_array($errors = imap_errors())) {
37            foreach ($errors as $err) {
38                if (strstr($err, 'GSSAPI') || strstr($err, 'Kerberos')) {
39                    echo "$err\n";
40                }
41            }
42        }
43    } else {
44        echo "Can't connect\n";
45    }
46}
47echo "Done\n";
48?>
49--EXPECTF--
50Test for Array
51Test for String
52Done
53