1--TEST--
2ldap_search() test
3--CREDITS--
4Davide Mendolia <idaf1er@gmail.com>
5Patrick Allaert <patrickallaert@php.net>
6Belgian PHP Testfest 2009
7--SKIPIF--
8<?php
9require_once('skipif.inc');
10require_once('skipifbindfailure.inc');
11?>
12--FILE--
13<?php
14include "connect.inc";
15
16$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
17insert_dummy_data($link, $base);
18
19$dn = "$base";
20$filter = "(objectclass=person)";
21var_dump(
22	$result = ldap_search($link, $dn, $filter, array('sn'), 1, 3),
23	ldap_get_entries($link, $result)
24);
25
26var_dump(
27	$result = ldap_search($link, $dn, $filter, array('sn'), 1, 1),
28	ldap_get_entries($link, $result)
29);
30?>
31===DONE===
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--
40resource(%d) of type (ldap result)
41array(4) {
42  ["count"]=>
43  int(3)
44  [0]=>
45  array(4) {
46    ["sn"]=>
47    array(1) {
48      ["count"]=>
49      int(0)
50    }
51    [0]=>
52    string(2) "sn"
53    ["count"]=>
54    int(1)
55    ["dn"]=>
56    string(%d) "cn=userA,%s"
57  }
58  [1]=>
59  array(4) {
60    ["sn"]=>
61    array(1) {
62      ["count"]=>
63      int(0)
64    }
65    [0]=>
66    string(2) "sn"
67    ["count"]=>
68    int(1)
69    ["dn"]=>
70    string(%d) "cn=userB,%s"
71  }
72  [2]=>
73  array(4) {
74    ["sn"]=>
75    array(1) {
76      ["count"]=>
77      int(0)
78    }
79    [0]=>
80    string(2) "sn"
81    ["count"]=>
82    int(1)
83    ["dn"]=>
84    string(%d) "cn=userC,cn=userB,%s"
85  }
86}
87
88Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
89resource(%d) of type (ldap result)
90array(2) {
91  ["count"]=>
92  int(1)
93  [0]=>
94  array(4) {
95    ["sn"]=>
96    array(1) {
97      ["count"]=>
98      int(0)
99    }
100    [0]=>
101    string(2) "sn"
102    ["count"]=>
103    int(1)
104    ["dn"]=>
105    string(%d) "cn=userA,%s"
106  }
107}
108===DONE===
109