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); 36var_dump(ldap_set_rebind_proc($link)); 37var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data")); 38var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistant")); 39?> 40===DONE=== 41--EXPECTF-- 42Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 1 given in %s on line %d 43bool(false) 44 45Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d 46bool(false) 47 48Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistant' to be a valid callback in %s on line %d 49bool(false) 50===DONE=== 51