ldap_unbind_variation.phpt 798 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. ldap_unbind() - Variation of ldap_unbind() function using ldap_set_rebind_proc()
  3. --CREDITS--
  4. Patrick Allaert <patrickallaert@php.net>
  5. # Belgian PHP Testfest 2009
  6. --SKIPIF--
  7. <?php require_once('skipif.inc'); ?>
  8. <?php require_once('skipifbindfailure.inc'); ?>
  9. --FILE--
  10. <?php
  11. require "connect.inc";
  12. function rebind_proc ($ds, $ldap_url) {
  13. global $user;
  14. global $passwd;
  15. global $protocol_version;
  16. // required by most modern LDAP servers, use LDAPv3
  17. ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
  18. if (!ldap_bind($a, $user, $passwd)) {
  19. print "Cannot bind";
  20. }
  21. }
  22. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  23. ldap_set_rebind_proc($link, "rebind_proc");
  24. var_dump(ldap_unbind($link));
  25. ?>
  26. ===DONE===
  27. --EXPECT--
  28. bool(true)
  29. ===DONE===