1--TEST--
2ldap_set_rebind_proc() - Basic ldap_set_rebind_proc test
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);
27var_dump(ldap_set_rebind_proc($link, "rebind_proc"));
28var_dump(ldap_set_rebind_proc($link, null));
29?>
30--EXPECT--
31bool(true)
32bool(true)
33