Skip to content

Commit 49d1cdc

Browse files
committed
ext/ldap/test: Test that ldap_connect() uses defaults from ldap.conf (openldap)
1 parent d51b8f9 commit 49d1cdc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
ldap_connect() - Connection using default host from openldap's ldap.conf
3+
--CREDITS--
4+
David Caldwell <david@galvanix.com>
5+
--SKIPIF--
6+
<?php
7+
require_once('skipif.inc');
8+
ob_start();
9+
phpinfo();
10+
if (!preg_match("/vendor name => openldap/i", ob_get_clean()))
11+
die("skip not openldap");
12+
?>
13+
--FILE--
14+
<?php
15+
$conf=tempnam("/tmp","ldap.conf");
16+
file_put_contents($conf, "uri ldaps://example.com:3141/");
17+
putenv("LDAPCONF=$conf");
18+
$link = ldap_connect();
19+
ldap_get_option($link, LDAP_OPT_HOST_NAME, $host);
20+
var_dump($host);
21+
unlink($conf);
22+
?>
23+
===DONE===
24+
--EXPECTF--
25+
string(16) "example.com:3141"
26+
===DONE===

0 commit comments

Comments
 (0)