ldap_search_overrides.phpt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. --TEST--
  2. ldap_search() test - test that overrides aren't permanent
  3. --CREDITS--
  4. Tyson Andre <tandre@ifwe.co>
  5. # Based on ldap_search_basic.phpt
  6. --EXTENSIONS--
  7. ldap
  8. --SKIPIF--
  9. <?php
  10. require_once('skipifbindfailure.inc');
  11. ?>
  12. --FILE--
  13. <?php
  14. include "connect.inc";
  15. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  16. ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_SEARCHING);
  17. ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
  18. ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
  19. ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
  20. insert_dummy_data($link, $base);
  21. var_dump(
  22. $result = ldap_search($link, "$base", "(objectClass=person)", array(), 0, 111, 22, LDAP_DEREF_NEVER),
  23. ldap_get_entries($link, $result)
  24. );
  25. var_dump(
  26. ldap_get_option($link, LDAP_OPT_DEREF, $option),
  27. $option,
  28. ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
  29. $option,
  30. ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
  31. $option,
  32. ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
  33. $option
  34. );
  35. ?>
  36. --CLEAN--
  37. <?php
  38. include "connect.inc";
  39. $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
  40. remove_dummy_data($link, $base);
  41. ?>
  42. --EXPECTF--
  43. object(LDAP\Result)#%d (0) {
  44. }
  45. array(4) {
  46. ["count"]=>
  47. int(3)
  48. [0]=>
  49. array(14) {
  50. ["objectclass"]=>
  51. array(2) {
  52. ["count"]=>
  53. int(1)
  54. [0]=>
  55. string(6) "person"
  56. }
  57. [0]=>
  58. string(11) "objectclass"
  59. ["cn"]=>
  60. array(2) {
  61. ["count"]=>
  62. int(1)
  63. [0]=>
  64. string(5) "userA"
  65. }
  66. [1]=>
  67. string(2) "cn"
  68. ["sn"]=>
  69. array(2) {
  70. ["count"]=>
  71. int(1)
  72. [0]=>
  73. string(7) "testSN1"
  74. }
  75. [2]=>
  76. string(2) "sn"
  77. ["userpassword"]=>
  78. array(2) {
  79. ["count"]=>
  80. int(1)
  81. [0]=>
  82. string(%d) "%s"
  83. }
  84. [3]=>
  85. string(12) "userpassword"
  86. ["telephonenumber"]=>
  87. array(2) {
  88. ["count"]=>
  89. int(1)
  90. [0]=>
  91. string(14) "xx-xx-xx-xx-xx"
  92. }
  93. [4]=>
  94. string(15) "telephonenumber"
  95. ["description"]=>
  96. array(2) {
  97. ["count"]=>
  98. int(1)
  99. [0]=>
  100. string(6) "user A"
  101. }
  102. [5]=>
  103. string(11) "description"
  104. ["count"]=>
  105. int(6)
  106. ["dn"]=>
  107. string(%d) "cn=userA,%s"
  108. }
  109. [1]=>
  110. array(12) {
  111. ["objectclass"]=>
  112. array(2) {
  113. ["count"]=>
  114. int(1)
  115. [0]=>
  116. string(6) "person"
  117. }
  118. [0]=>
  119. string(11) "objectclass"
  120. ["cn"]=>
  121. array(2) {
  122. ["count"]=>
  123. int(1)
  124. [0]=>
  125. string(5) "userB"
  126. }
  127. [1]=>
  128. string(2) "cn"
  129. ["sn"]=>
  130. array(2) {
  131. ["count"]=>
  132. int(1)
  133. [0]=>
  134. string(7) "testSN2"
  135. }
  136. [2]=>
  137. string(2) "sn"
  138. ["userpassword"]=>
  139. array(2) {
  140. ["count"]=>
  141. int(1)
  142. [0]=>
  143. string(%d) "%s"
  144. }
  145. [3]=>
  146. string(12) "userpassword"
  147. ["description"]=>
  148. array(2) {
  149. ["count"]=>
  150. int(1)
  151. [0]=>
  152. string(6) "user B"
  153. }
  154. [4]=>
  155. string(11) "description"
  156. ["count"]=>
  157. int(5)
  158. ["dn"]=>
  159. string(%d) "cn=userB,%s"
  160. }
  161. [2]=>
  162. array(10) {
  163. ["objectclass"]=>
  164. array(2) {
  165. ["count"]=>
  166. int(1)
  167. [0]=>
  168. string(6) "person"
  169. }
  170. [0]=>
  171. string(11) "objectclass"
  172. ["cn"]=>
  173. array(2) {
  174. ["count"]=>
  175. int(1)
  176. [0]=>
  177. string(5) "userC"
  178. }
  179. [1]=>
  180. string(2) "cn"
  181. ["sn"]=>
  182. array(2) {
  183. ["count"]=>
  184. int(1)
  185. [0]=>
  186. string(7) "testSN3"
  187. }
  188. [2]=>
  189. string(2) "sn"
  190. ["userpassword"]=>
  191. array(2) {
  192. ["count"]=>
  193. int(1)
  194. [0]=>
  195. string(%d) "%s"
  196. }
  197. [3]=>
  198. string(12) "userpassword"
  199. ["count"]=>
  200. int(4)
  201. ["dn"]=>
  202. string(%d) "cn=userC,cn=userB,%s"
  203. }
  204. }
  205. bool(true)
  206. int(1)
  207. bool(true)
  208. int(123)
  209. bool(true)
  210. int(33)
  211. bool(true)
  212. int(44)