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