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