ldap_explode_dn.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. --TEST--
  2. ldap_explode_dn() test
  3. --EXTENSIONS--
  4. ldap
  5. --FILE--
  6. <?php
  7. /* Explode with attributes */
  8. var_dump(ldap_explode_dn("cn=bob,dc=example,dc=com", 0));
  9. /* Explode with attributes */
  10. var_dump(ldap_explode_dn("cn=bob,ou=users,dc=example,dc=com", 0));
  11. /* Explode without attributes */
  12. var_dump(ldap_explode_dn("cn=bob,dc=example,dc=com", 1));
  13. /* Explode without attributes */
  14. var_dump(ldap_explode_dn("cn=bob,ou=users,dc=example,dc=com", 1));
  15. /* Explode with attributes and < > characters */
  16. var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 0));
  17. /* Explode without attributes and < > characters */
  18. var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 1));
  19. /* Bad DN value with attributes */
  20. var_dump(ldap_explode_dn("bob,dc=example,dc=com", 0));
  21. /* Bad DN value without attributes */
  22. var_dump(ldap_explode_dn("bob,dc=example,dc=com", 1));
  23. echo "Done\n";
  24. ?>
  25. --EXPECT--
  26. array(4) {
  27. ["count"]=>
  28. int(3)
  29. [0]=>
  30. string(6) "cn=bob"
  31. [1]=>
  32. string(10) "dc=example"
  33. [2]=>
  34. string(6) "dc=com"
  35. }
  36. array(5) {
  37. ["count"]=>
  38. int(4)
  39. [0]=>
  40. string(6) "cn=bob"
  41. [1]=>
  42. string(8) "ou=users"
  43. [2]=>
  44. string(10) "dc=example"
  45. [3]=>
  46. string(6) "dc=com"
  47. }
  48. array(4) {
  49. ["count"]=>
  50. int(3)
  51. [0]=>
  52. string(3) "bob"
  53. [1]=>
  54. string(7) "example"
  55. [2]=>
  56. string(3) "com"
  57. }
  58. array(5) {
  59. ["count"]=>
  60. int(4)
  61. [0]=>
  62. string(3) "bob"
  63. [1]=>
  64. string(5) "users"
  65. [2]=>
  66. string(7) "example"
  67. [3]=>
  68. string(3) "com"
  69. }
  70. bool(false)
  71. bool(false)
  72. bool(false)
  73. bool(false)
  74. Done