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