1--TEST--
2ldap_ldap_control_paged_result() test (fetching the first page then the next final page)
3--CREDITS--
4Jean-Sebastien Hedde <jeanseb@au-fil-du.net>
5--SKIPIF--
6<?php
7require_once('skipif.inc');
8require_once('skipifbindfailure.inc');
9?>
10--FILE--
11<?php
12include "connect.inc";
13
14$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
15insert_dummy_data($link, $base);
16
17$dn = "$base";
18$filter = "(cn=user*)";
19$cookie = '';
20var_dump(
21	ldap_control_paged_result($link, 2, true, $cookie),
22	$result = ldap_search($link, $dn, $filter, array('cn')),
23	ldap_get_entries($link, $result),
24	ldap_control_paged_result_response($link, $result, $cookie),
25	ldap_control_paged_result($link, 20, true, $cookie),
26	$result = ldap_search($link, $dn, $filter, array('cn')),
27	ldap_get_entries($link, $result)
28);
29?>
30===DONE===
31--CLEAN--
32<?php
33include "connect.inc";
34
35$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
36remove_dummy_data($link, $base);
37?>
38--EXPECTF--
39bool(true)
40resource(%d) of type (ldap result)
41array(3) {
42  ["count"]=>
43  int(2)
44  [0]=>
45  array(4) {
46    ["cn"]=>
47    array(2) {
48      ["count"]=>
49      int(1)
50      [0]=>
51      string(5) "userA"
52    }
53    [0]=>
54    string(2) "cn"
55    ["count"]=>
56    int(1)
57    ["dn"]=>
58    string(%d) "cn=userA,%s"
59  }
60  [1]=>
61  array(4) {
62    ["cn"]=>
63    array(2) {
64      ["count"]=>
65      int(1)
66      [0]=>
67      string(5) "userB"
68    }
69    [0]=>
70    string(2) "cn"
71    ["count"]=>
72    int(1)
73    ["dn"]=>
74    string(%d) "cn=userB,%s"
75  }
76}
77bool(true)
78bool(true)
79resource(%d) of type (ldap result)
80array(2) {
81  ["count"]=>
82  int(1)
83  [0]=>
84  array(4) {
85    ["cn"]=>
86    array(2) {
87      ["count"]=>
88      int(1)
89      [0]=>
90      string(5) "userC"
91    }
92    [0]=>
93    string(2) "cn"
94    ["count"]=>
95    int(1)
96    ["dn"]=>
97    string(%d) "cn=userC,cn=userB,%s"
98  }
99}
100===DONE===
101