1--TEST--
2ldap_parse_result() - Test the parsing of controls from result object
3--CREDITS--
4Côme Chilliet <mcmic@php.net>
5--SKIPIF--
6<?php require_once('skipif.inc'); ?>
7<?php require_once('skipifbindfailure.inc'); ?>
8<?php
9require_once('skipifcontrol.inc');
10skipifunsupportedcontrol(LDAP_CONTROL_PAGEDRESULTS);
11?>
12--FILE--
13<?php
14require "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 = "(cn=user*)";
21var_dump(
22    $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
23        [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'iscritical' => TRUE, 'value' => ['size' => 1]]]),
24    ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls),
25    $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'],
26    $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'],
27    bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']),
28    ldap_get_entries($link, $result)['count']
29);
30?>
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--
39resource(%d) of type (ldap result)
40bool(true)
41string(22) "1.2.840.113556.1.4.319"
42int(%d)
43string(%d) "%s"
44int(1)
45