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