Skip to content

Commit 9214724

Browse files
committed
add unit test for bug 63126
1 parent 90d2561 commit 9214724

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

ext/imap/tests/bug63126.phpt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
--TEST--
2+
imap_open() DISABLE_AUTHENTICATOR ignores array param
3+
--SKIPIF--
4+
<?php
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
6+
7+
require_once(dirname(__FILE__).'/imap_include.inc');
8+
9+
$in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1);
10+
if (!$in) {
11+
die("skip could not connect to mailbox $default_mailbox");
12+
}
13+
$kerberos = false;
14+
if (is_array($errors = imap_errors())) {
15+
foreach ($errors as $err) {
16+
if (strstr($err, 'GSSAPI') || strstr($err, 'Kerberos')) {
17+
$kerberos = true;
18+
}
19+
}
20+
}
21+
if (!$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+
);
31+
require_once(dirname(__FILE__).'/imap_include.inc');
32+
foreach ($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+
}
47+
echo "Done\n";
48+
?>
49+
--EXPECTF--
50+
Test for Array
51+
Test for String
52+
Done

0 commit comments

Comments
 (0)