php-src/ext/ldap/tests/ldap_unbind_variation.phpt

34 lines
778 B
Plaintext
Raw Normal View History

--TEST--
ldap_unbind() - Variation of ldap_unbind() function using ldap_set_rebind_proc()
--CREDITS--
Patrick Allaert <patrickallaert@php.net>
# Belgian PHP Testfest 2009
2021-06-11 12:49:22 +00:00
--EXTENSIONS--
ldap
--SKIPIF--
<?php require_once('skipifbindfailure.inc'); ?>
--FILE--
<?php
require "connect.inc";
function rebind_proc ($ds, $ldap_url) {
2020-02-03 21:52:20 +00:00
global $user;
global $passwd;
global $protocol_version;
2018-09-16 17:16:42 +00:00
2020-02-03 21:52:20 +00:00
// required by most modern LDAP servers, use LDAPv3
ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
2018-09-16 17:16:42 +00:00
2020-02-03 21:52:20 +00:00
if (!ldap_bind($a, $user, $passwd)) {
print "Cannot bind";
}
}
$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
ldap_set_rebind_proc($link, "rebind_proc");
var_dump(ldap_unbind($link));
?>
--EXPECT--
bool(true)