summaryrefslogtreecommitdiff
path: root/ext/ldap/tests/ldap_parse_result_controls.phpt
blob: 8ce2328d2feaa3fadb33194b7ef37ff4ecea69d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--TEST--
ldap_parse_result() - Test the parsing of controls from result object
--CREDITS--
Côme Chilliet <mcmic@php.net>
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifbindfailure.inc'); ?>
<?php
require_once('skipifcontrol.inc');
skipifunsupportedcontrol(LDAP_CONTROL_PAGEDRESULTS);
?>
--FILE--
<?php
require "connect.inc";

$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);

$dn = "$base";
$filter = "(cn=user*)";
var_dump(
	ldap_control_paged_result($link, 1),
	$result = ldap_search($link, $dn, $filter, array('cn')),
	ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls),
	$ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'],
	$ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'],
	bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']),
	ldap_get_entries($link, $result)['count']
);
?>
===DONE===
--CLEAN--
<?php
include "connect.inc";

$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
Deprecated: Function ldap_control_paged_result() is deprecated in %s.php on line %d
bool(true)
resource(%d) of type (ldap result)
bool(true)
string(22) "1.2.840.113556.1.4.319"
int(%d)
string(%d) "%s"
int(1)
===DONE===