1--TEST--
2ldap_parse_result() - Test the parsing of controls from result object
3--CREDITS--
4Côme Chilliet <mcmic@php.net>
5--EXTENSIONS--
6ldap
7--SKIPIF--
8<?php require_once('skipifbindfailure.inc'); ?>
9<?php
10require_once('skipifcontrol.inc');
11skipifunsupportedcontrol(LDAP_CONTROL_PAGEDRESULTS);
12?>
13--FILE--
14<?php
15require "connect.inc";
16
17$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
18insert_dummy_data($link, $base);
19
20$dn = "$base";
21$filter = "(cn=user*)";
22var_dump(
23    $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
24        [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'iscritical' => TRUE, 'value' => ['size' => 1]]]),
25    ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls),
26    $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'],
27    $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'],
28    bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']),
29    ldap_get_entries($link, $result)['count']
30);
31?>
32--CLEAN--
33<?php
34include "connect.inc";
35
36$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
37remove_dummy_data($link, $base);
38?>
39--EXPECTF--
40object(LDAP\Result)#%d (0) {
41}
42bool(true)
43string(22) "1.2.840.113556.1.4.319"
44int(%d)
45string(%d) "%s"
46int(1)
47