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, 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--CLEAN--
35<?php
36include "connect.inc";
37
38$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
39remove_dummy_data($link, $base);
40?>
41--EXPECTF--
42Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
43resource(%d) of type (ldap result)
44array(2) {
45  ["count"]=>
46  int(1)
47  [0]=>
48  array(4) {
49    ["sn"]=>
50    array(1) {
51      ["count"]=>
52      int(0)
53    }
54    [0]=>
55    string(2) "sn"
56    ["count"]=>
57    int(1)
58    ["dn"]=>
59    string(%d) "cn=userA,%s"
60  }
61}
62
63Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
64resource(%d) of type (ldap result)
65array(2) {
66  ["count"]=>
67  int(1)
68  [0]=>
69  array(4) {
70    ["sn"]=>
71    array(1) {
72      ["count"]=>
73      int(0)
74    }
75    [0]=>
76    string(2) "sn"
77    ["count"]=>
78    int(1)
79    ["dn"]=>
80    string(%d) "cn=userA,%s"
81  }
82}
83
84Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
85resource(%d) of type (ldap result)
86array(2) {
87  ["count"]=>
88  int(1)
89  [0]=>
90  array(4) {
91    ["sn"]=>
92    array(1) {
93      ["count"]=>
94      int(0)
95    }
96    [0]=>
97    string(2) "sn"
98    ["count"]=>
99    int(1)
100    ["dn"]=>
101    string(%d) "cn=userA,%s"
102  }
103}
104