1--TEST--
2ldap_parse_result() - Basic ldap_parse_result test
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8<?php require_once('skipifbindfailure.inc'); ?>
9--FILE--
10<?php
11require "connect.inc";
12
13$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
14insert_dummy_data($link, $base);
15ldap_add($link, "cn=userref,$base", array(
16        "objectClass" => array("extensibleObject", "referral"),
17        "cn" => "userref",
18        "ref" => "cn=userA,$base",
19));
20$result = ldap_search($link, "cn=userref,$base", "(cn=user*)");
21$errcode = $dn = $errmsg = $refs =  null;
22var_dump(
23    ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs),
24    $errcode, $dn, $errmsg, $refs
25);
26?>
27--CLEAN--
28<?php
29include "connect.inc";
30
31$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
32// Referral can only be removed with Manage DSA IT Control
33ldap_delete($link, "cn=userref,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]);
34remove_dummy_data($link, $base);
35?>
36--EXPECTF--
37bool(true)
38int(10)
39string(%d) "cn=userref,%s"
40string(0) ""
41array(1) {
42  [0]=>
43  string(%d) "cn=userA,%s"
44}
45