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--EXTENSIONS--
7ldap
8--SKIPIF--
9<?php
10if (!function_exists('ldap_set_rebind_proc')) die("skip ldap_set_rebind_proc() not available");
11require_once('skipifbindfailure.inc');
12?>
13--FILE--
14<?php
15require "connect.inc";
16
17function rebind_proc ($ds, $ldap_url) {
18  global $user;
19  global $passwd;
20  global $protocol_version;
21
22  // required by most modern LDAP servers, use LDAPv3
23  ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
24
25  if (!ldap_bind($a, $user, $passwd)) {
26        print "Cannot bind";
27  }
28}
29
30$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
31var_dump(ldap_set_rebind_proc($link, "rebind_proc"));
32var_dump(ldap_set_rebind_proc($link, null));
33?>
34--EXPECT--
35bool(true)
36bool(true)
37