1--TEST--
2ldap_set_rebind_proc() - Testing ldap_set_rebind_proc() that should fail
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8<?php
9    if (!function_exists("ldap_set_rebind_proc")) {
10        die("skip ldap_set_rebind_proc() does not exist");
11    }
12    require "connect.inc";
13    $link = @fsockopen($host, $port);
14    if (!$link) {
15        die("skip no server listening");
16    }
17?>
18--FILE--
19<?php
20require "connect.inc";
21
22function rebind_proc ($ds, $ldap_url) {
23  global $user;
24  global $passwd;
25  global $protocol_version;
26
27  // required by most modern LDAP servers, use LDAPv3
28  ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
29
30  if (!ldap_bind($a, $user, $passwd)) {
31        print "Cannot bind";
32  }
33}
34
35$link = ldap_connect($host, $port);
36try {
37    $result = ldap_set_rebind_proc($link, "rebind_proc_inexistent");
38} catch(\TypeError $error) {
39    echo $error->getMessage(), "\n";
40}
41?>
42--EXPECT--
43ldap_set_rebind_proc(): Argument #2 ($callback) must be a valid callback or null, function "rebind_proc_inexistent" not found or invalid function name
44