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($uri, $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, 1, 3, LDAP_DEREF_SEARCHING),
24    ldap_get_entries($link, $result)
25);
26var_dump(
27    $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_FINDING),
28    ldap_get_entries($link, $result)
29);
30var_dump(
31    $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_ALWAYS),
32    ldap_get_entries($link, $result)
33);
34?>
35--CLEAN--
36<?php
37include "connect.inc";
38
39$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
40remove_dummy_data($link, $base);
41?>
42--EXPECTF--
43Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
44object(LDAP\Result)#%d (0) {
45}
46array(2) {
47  ["count"]=>
48  int(1)
49  [0]=>
50  array(4) {
51    ["sn"]=>
52    array(1) {
53      ["count"]=>
54      int(0)
55    }
56    [0]=>
57    string(2) "sn"
58    ["count"]=>
59    int(1)
60    ["dn"]=>
61    string(%d) "cn=userA,%s"
62  }
63}
64
65Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
66object(LDAP\Result)#%d (0) {
67}
68array(2) {
69  ["count"]=>
70  int(1)
71  [0]=>
72  array(4) {
73    ["sn"]=>
74    array(1) {
75      ["count"]=>
76      int(0)
77    }
78    [0]=>
79    string(2) "sn"
80    ["count"]=>
81    int(1)
82    ["dn"]=>
83    string(%d) "cn=userA,%s"
84  }
85}
86
87Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d
88object(LDAP\Result)#%d (0) {
89}
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