ldap_bind_error.phpt 948 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. ldap_bind() - Binding that should fail
  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. $link = ldap_connect($host, $port);
  13. ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
  14. // Invalid parameter count
  15. var_dump(ldap_bind($link, $user, $passwd, null));
  16. // Invalid password
  17. var_dump(ldap_bind($link, $user, "ThisIsNotCorrect$passwd"));
  18. // Invalid DN syntax
  19. var_dump(ldap_bind($link, "unexistingProperty=weirdValue,$user", $passwd));
  20. ?>
  21. ===DONE===
  22. --EXPECTF--
  23. Warning: ldap_bind() expects at most 3 parameters, 4 given in %s on line %d
  24. bool(false)
  25. Warning: ldap_bind(): Unable to bind to server: Invalid credentials in %s on line %d
  26. bool(false)
  27. Warning: ldap_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
  28. bool(false)
  29. ===DONE===