1--TEST--
2ldap_unbind() - Variation of ldap_unbind() function using ldap_set_rebind_proc()
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8<?php require_once('skipifbindfailure.inc'); ?>
9--FILE--
10<?php
11require "connect.inc";
12
13function rebind_proc ($ds, $ldap_url) {
14	global $user;
15	global $passwd;
16	global $protocol_version;
17
18	// required by most modern LDAP servers, use LDAPv3
19	ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
20
21	if (!ldap_bind($a, $user, $passwd)) {
22		print "Cannot bind";
23	}
24}
25
26$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
27ldap_set_rebind_proc($link, "rebind_proc");
28
29var_dump(ldap_unbind($link));
30?>
31===DONE===
32--EXPECT--
33bool(true)
34===DONE===
35