]> granicus.if.org Git - php/commitdiff
ext/ldap/test: Test that ldap_connect() uses defaults from ldap.conf (openldap)
authorDavid Caldwell <david@galvanix.com>
Thu, 25 May 2017 21:27:11 +0000 (21:27 +0000)
committerDavid Caldwell <david@galvanix.com>
Thu, 25 May 2017 21:27:11 +0000 (21:27 +0000)
ext/ldap/tests/ldap_connect_ldap_conf.phpt [new file with mode: 0644]

diff --git a/ext/ldap/tests/ldap_connect_ldap_conf.phpt b/ext/ldap/tests/ldap_connect_ldap_conf.phpt
new file mode 100644 (file)
index 0000000..5379de4
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+ldap_connect() - Connection using default host from openldap's ldap.conf
+--CREDITS--
+David Caldwell <david@galvanix.com>
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+ob_start();
+phpinfo();
+if (!preg_match("/vendor name => openldap/i", ob_get_clean()))
+    die("skip not openldap");
+?>
+--FILE--
+<?php
+$conf=tempnam("/tmp","ldap.conf");
+file_put_contents($conf, "uri ldaps://example.com:3141/");
+putenv("LDAPCONF=$conf");
+$link = ldap_connect();
+ldap_get_option($link, LDAP_OPT_HOST_NAME, $host);
+var_dump($host);
+unlink($conf);
+?>
+===DONE===
+--EXPECTF--
+string(16) "example.com:3141"
+===DONE===