1--TEST-- 2ldap_unbind() - Variation of ldap_unbind() function using ldap_set_rebind_proc() 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($uri, $user, $passwd, $protocol_version); 31ldap_set_rebind_proc($link, "rebind_proc"); 32 33var_dump(ldap_unbind($link)); 34?> 35--EXPECT-- 36bool(true) 37