xref: /PHP-8.2/ext/imap/tests/bug63126.phpt (revision 39131219)
1--TEST--
2imap_open() DISABLE_AUTHENTICATOR ignores array param
3--EXTENSIONS--
4imap
5--SKIPIF--
6<?php
7require_once(__DIR__. '/setup/imap_include.inc');
8
9$in = @imap_open(IMAP_SERVER_DEBUG, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, OP_HALFOPEN, 1);
10if (!$in) {
11    die("skip could not connect to mailbox " . IMAP_SERVER_DEBUG);
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--CONFLICTS--
26defaultmailbox
27--FILE--
28<?php
29// TODO Test Kerberos on CI
30$tests = array(
31    'Array'  => array('DISABLE_AUTHENTICATOR' => array('GSSAPI','NTLM')),
32    'String' => array('DISABLE_AUTHENTICATOR' => 'GSSAPI'),
33);
34require_once(__DIR__. '/setup/imap_include.inc');
35foreach ($tests as $name => $testparams) {
36    echo "Test for $name\n";
37    $in = imap_open(IMAP_SERVER_DEBUG, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, OP_HALFOPEN, 1, $testparams);
38    if ($in) {
39        if (is_array($errors = imap_errors())) {
40            foreach ($errors as $err) {
41                if (strstr($err, 'GSSAPI') || strstr($err, 'Kerberos')) {
42                    echo "$err\n";
43                }
44            }
45        }
46    } else {
47        echo "Can't connect\n";
48    }
49}
50echo "Done\n";
51?>
52--EXPECT--
53Test for Array
54Test for String
55Done
56