1--TEST--
2ldap_search() test
3--CREDITS--
4Davide Mendolia <idaf1er@gmail.com>
5Patrick Allaert <patrickallaert@php.net>
6Belgian PHP Testfest 2009
7--EXTENSIONS--
8ldap
9--SKIPIF--
10<?php
11require_once('skipifbindfailure.inc');
12?>
13--FILE--
14<?php
15include "connect.inc";
16
17$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
18insert_dummy_data($link, $base);
19
20$dn = "$base";
21$filter = "(objectclass=person)";
22
23var_dump(
24    $result = ldap_search(array($link, $link), $dn, $filter),
25    $result0 = ldap_get_entries($link, $result[0]),
26    ldap_get_entries($link, $result[1]) === $result0
27);
28var_dump(
29    $result = ldap_search(array($link, $link), "", $filter),
30    ldap_get_entries($link, $result[0]),
31    ldap_get_entries($link, $result[1])
32);
33var_dump(
34    $result = ldap_search(array($link, $link), "", array($filter, $filter)),
35    ldap_get_entries($link, $result[0]),
36    ldap_get_entries($link, $result[1])
37);
38?>
39--CLEAN--
40<?php
41include "connect.inc";
42
43$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
44remove_dummy_data($link, $base);
45?>
46--EXPECTF--
47array(2) {
48  [0]=>
49  object(LDAP\Result)#%d (0) {
50  }
51  [1]=>
52  object(LDAP\Result)#%d (0) {
53  }
54}
55array(4) {
56  ["count"]=>
57  int(3)
58  [0]=>
59  array(14) {
60    ["objectclass"]=>
61    array(2) {
62      ["count"]=>
63      int(1)
64      [0]=>
65      string(6) "person"
66    }
67    [0]=>
68    string(11) "objectclass"
69    ["cn"]=>
70    array(2) {
71      ["count"]=>
72      int(1)
73      [0]=>
74      string(5) "userA"
75    }
76    [1]=>
77    string(2) "cn"
78    ["sn"]=>
79    array(2) {
80      ["count"]=>
81      int(1)
82      [0]=>
83      string(7) "testSN1"
84    }
85    [2]=>
86    string(2) "sn"
87    ["userpassword"]=>
88    array(2) {
89      ["count"]=>
90      int(1)
91      [0]=>
92      string(%d) "%s"
93    }
94    [3]=>
95    string(12) "userpassword"
96    ["telephonenumber"]=>
97    array(2) {
98      ["count"]=>
99      int(1)
100      [0]=>
101      string(14) "xx-xx-xx-xx-xx"
102    }
103    [4]=>
104    string(15) "telephonenumber"
105    ["description"]=>
106    array(2) {
107      ["count"]=>
108      int(1)
109      [0]=>
110      string(6) "user A"
111    }
112    [5]=>
113    string(11) "description"
114    ["count"]=>
115    int(6)
116    ["dn"]=>
117    string(%d) "cn=userA,%s"
118  }
119  [1]=>
120  array(12) {
121    ["objectclass"]=>
122    array(2) {
123      ["count"]=>
124      int(1)
125      [0]=>
126      string(6) "person"
127    }
128    [0]=>
129    string(11) "objectclass"
130    ["cn"]=>
131    array(2) {
132      ["count"]=>
133      int(1)
134      [0]=>
135      string(5) "userB"
136    }
137    [1]=>
138    string(2) "cn"
139    ["sn"]=>
140    array(2) {
141      ["count"]=>
142      int(1)
143      [0]=>
144      string(7) "testSN2"
145    }
146    [2]=>
147    string(2) "sn"
148    ["userpassword"]=>
149    array(2) {
150      ["count"]=>
151      int(1)
152      [0]=>
153      string(%d) "%s"
154    }
155    [3]=>
156    string(12) "userpassword"
157    ["description"]=>
158    array(2) {
159      ["count"]=>
160      int(1)
161      [0]=>
162      string(6) "user B"
163    }
164    [4]=>
165    string(11) "description"
166    ["count"]=>
167    int(5)
168    ["dn"]=>
169    string(%d) "cn=userB,%s"
170  }
171  [2]=>
172  array(10) {
173    ["objectclass"]=>
174    array(2) {
175      ["count"]=>
176      int(1)
177      [0]=>
178      string(6) "person"
179    }
180    [0]=>
181    string(11) "objectclass"
182    ["cn"]=>
183    array(2) {
184      ["count"]=>
185      int(1)
186      [0]=>
187      string(5) "userC"
188    }
189    [1]=>
190    string(2) "cn"
191    ["sn"]=>
192    array(2) {
193      ["count"]=>
194      int(1)
195      [0]=>
196      string(7) "testSN3"
197    }
198    [2]=>
199    string(2) "sn"
200    ["userpassword"]=>
201    array(2) {
202      ["count"]=>
203      int(1)
204      [0]=>
205      string(%d) "%s"
206    }
207    [3]=>
208    string(12) "userpassword"
209    ["count"]=>
210    int(4)
211    ["dn"]=>
212    string(%d) "cn=userC,cn=userB,%s"
213  }
214}
215bool(true)
216array(2) {
217  [0]=>
218  object(LDAP\Result)#%d (0) {
219  }
220  [1]=>
221  object(LDAP\Result)#%d (0) {
222  }
223}
224array(1) {
225  ["count"]=>
226  int(0)
227}
228array(1) {
229  ["count"]=>
230  int(0)
231}
232array(2) {
233  [0]=>
234  object(LDAP\Result)#%d (0) {
235  }
236  [1]=>
237  object(LDAP\Result)#%d (0) {
238  }
239}
240array(1) {
241  ["count"]=>
242  int(0)
243}
244array(1) {
245  ["count"]=>
246  int(0)
247}
248