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($host, $port, $user, $passwd, $protocol_version);
18insert_dummy_data($link, $base);
19
20$dn = "$base";
21$filter = "(objectclass=person)";
22var_dump(
23    $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3),
24    ldap_get_entries($link, $result)
25);
26
27var_dump(
28    $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1),
29    ldap_get_entries($link, $result)
30);
31?>
32--CLEAN--
33<?php
34include "connect.inc";
35
36$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
37remove_dummy_data($link, $base);
38?>
39--EXPECTF--
40object(LDAP\Result)#%d (0) {
41}
42array(4) {
43  ["count"]=>
44  int(3)
45  [0]=>
46  array(4) {
47    ["sn"]=>
48    array(1) {
49      ["count"]=>
50      int(0)
51    }
52    [0]=>
53    string(2) "sn"
54    ["count"]=>
55    int(1)
56    ["dn"]=>
57    string(%d) "cn=userA,%s"
58  }
59  [1]=>
60  array(4) {
61    ["sn"]=>
62    array(1) {
63      ["count"]=>
64      int(0)
65    }
66    [0]=>
67    string(2) "sn"
68    ["count"]=>
69    int(1)
70    ["dn"]=>
71    string(%d) "cn=userB,%s"
72  }
73  [2]=>
74  array(4) {
75    ["sn"]=>
76    array(1) {
77      ["count"]=>
78      int(0)
79    }
80    [0]=>
81    string(2) "sn"
82    ["count"]=>
83    int(1)
84    ["dn"]=>
85    string(%d) "cn=userC,cn=userB,%s"
86  }
87}
88
89Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
90object(LDAP\Result)#%d (0) {
91}
92array(2) {
93  ["count"]=>
94  int(1)
95  [0]=>
96  array(4) {
97    ["sn"]=>
98    array(1) {
99      ["count"]=>
100      int(0)
101    }
102    [0]=>
103    string(2) "sn"
104    ["count"]=>
105    int(1)
106    ["dn"]=>
107    string(%d) "cn=userA,%s"
108  }
109}
110