Annotation of embedaddon/php/ext/ldap/tests/ldap_set_rebind_proc_error.phpt, revision 1.1.1.3
1.1 misho 1: --TEST--
2: ldap_set_rebind_proc() - Testing ldap_set_rebind_proc() that should fail
3: --CREDITS--
4: Patrick Allaert <patrickallaert@php.net>
5: # Belgian PHP Testfest 2009
6: --SKIPIF--
7: <?php require_once('skipif.inc'); ?>
1.1.1.2 misho 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: ?>
1.1 misho 18: --FILE--
19: <?php
20: require "connect.inc";
21:
22: function 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);
36: var_dump(ldap_set_rebind_proc($link));
37: var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data"));
1.1.1.3 ! misho 38: var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent"));
1.1 misho 39: ?>
40: ===DONE===
41: --EXPECTF--
42: Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 1 given in %s on line %d
43: bool(false)
44:
45: Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d
46: bool(false)
47:
1.1.1.3 ! misho 48: Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistent' to be a valid callback in %s on line %d
1.1 misho 49: bool(false)
50: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>